Can anyone help me with this. (C++) I just have a few parts that I can not figure out.

Ok, here is the question......
1. Bring in the program lab4.cpp and the data file transaction.txt. a. Read the program to understand what it is doing. b. Add the code necessary to compute a total bill and clean up the input file handle.
Modify lab4.cpp so that it sends its output to a file named bill.txt.
2. Five locations in the program are marked //CHANGE TO LOOP. Replace these lines with the code to produce the same output, 40 dashes, in a suitable loop. Note: You need to write this code only once and then copy it to the other three locations. But make your copy only when you're sure the code is correct.
3. Modify the program so that it will stop when it reads -1 as a sentinel value for the item quantity. Change transaction.txt so that it contains -1 on the last line of the file. Be sure that the output bill does not include this last line item.

This is what I have for lab4.cpp http://pastebin.com/AQX1RrGV

This is what the transaction says but I already call that in.
2 Shamrocks 0.75
1 PotO'Gold 2.50
3 Rainbow 2.50
1 Bagpipes 0.50
2 Sheleighly 0.25

The parts I can't figure out are in the comments on the program I know that this is alot but it is killing me!!!
Last edited on
Would this be right for the loop part with the dashes?

for (int i = 0; i < 40; i++)
{
cout << "-";
}
Topic archived. No new replies allowed.