functions

Mar 25, 2015 at 2:48am
I don't really have a code. Functions confuse me and I need help figuring out how to write the function for the following program: Write three independent functions to handle the problem of calculating the bill at a coffee shop.
The first prompts for input values and gives them back to the caller; the second calculates the extended line amounts, subtotal, tax, and grand total of the bill; and the third prints the bill itself. the shop sells three items: coffee, bagel, and eggs.
Also if there are three items that I need to ask the user for quantities of, how can I return all the quantities for each of the three items?

I don't really want anyone to write the code, i just need help understanding how to write it...
Mar 25, 2015 at 2:52am
What is it about functions that confuse you?
Mar 25, 2015 at 3:01am
Like I don't understand how to give the input values back to the user because there are more than one value that i have to return back to the caller.
Mar 25, 2015 at 3:16am
You can just print out the values with <iostream>

1
2
int val = 0;
std::cout << val;


This will print out zero (0), you can do this for as many functions as you like.

What else confuses you about functions?
Mar 25, 2015 at 3:42am
Scroll down and read the part about passing arguments by value and by reference.

http://www.cplusplus.com/doc/tutorial/functions/
Mar 25, 2015 at 6:31am
theres a lot of tutorials in google,
you wont be able to answer that if you cannot do a simple input program
Topic archived. No new replies allowed.