I implemented this code to the teacher pseudocode and for some reason it doesnt complete the transaction
// Name: Liat Ledder
// Email: ledder.liat@titans.easternflorida.edu
// Purpose:
// To match the master and transaction file records and update the total
// paid for each client by adding the current week's price paid to the cumulative total.
You should check to insure your files opened properly before you try to read or write to them. Since your loop requires the eof flag to be set before it will exit, it'll never exit if the file didn't open.
How do you know? You're not checking to insure the files opened correctly, so maybe they didn't. You should always check to insure the files open correctly, failure is a very frequent occurrence.
Yes the files open succesfuly.. I wish there was a way I could attach them so you can see but there isnt...Im not dure what to do now:(
I think you're misunderstanding the idea here. Attaching the files and posting them here wouldn't help, it wouldn't show what happens when your program is executed.
One thing you can do, after a line like this for example:
masterFile_in.open("Master.rtf");
is to add something like this:
1 2 3 4 5 6
if ( !masterFile_in.is_open() )
{
cout << "Error: masterFile_in is not open" << endl;
system("PAUSE");
return 1;
}
(Normally I wouldn't suggest using system(anything), but I don't want to distract too much from the main topic.)
You can add similar code after opening the other files. Then at least you'll be able to eliminate one possible cause of problems.