Reciept Program

Hello,

I've been lurking around the forums for a while, picking up random bits of knowledge for use in my Intro to C++ class. However, my teacher assigned this problem as extra credit, and it truly stumping me. Just posting to see if anyone wanted to help out a bit, give tips, dumb things down, etc.

Basically, we need to create a program that creates receipts. The actual guidelines are

a. The main program must be smaller than 10 lines long (not including comments or variable definitions)…this means you need to use functions
b. There must be at least 2 functions with arguments. Both pass by value and pass by reference must be used in this program.
c. No GLOBAL variables are allowed
d. Arrays of characters must be used.

Anyone got any tips/ideas?
explain 'creates receipts'.
The person using the program would have to enter a name of the product and a price, and the receipt would track of the items entered, their price, and a running total.
Well, first write the program ignoring the conditions. Then try to reduce it's size. Then split it into functions. I suggest one for input and one for output. the input one could take as parameters the array of labels and the array of prices (I wonder is passing a pointer should be considered passing by reference or by value..) and by reference take an integer that will show how many items were read and one for total sum. the output function could take the same arrays and the same integers but pass them by value as they won't have to be modified.
Topic archived. No new replies allowed.