The purpose of the program is written at the top in the comment statements. My problem is with the second half, with the file output. I have tried the file input part by itself, and it works. I have commented that out, and tried the file output part by itself, and it works. But, when I put the two together, the program will not read/write to the file.
/* Joshua McCullough
3/11/10
Programming Exercise 12.8 - This program will use data files to
track how many times a program has
been executed.
*/
#include <iostream>
#include <fstream>
usingnamespace std;
int main()
{
int counter;
fstream inout;
inout.open("Exercise12_8.dat", ios::in);
inout >> counter;
inout.close();
inout.open("Exercise12_8.dat", ios::out);
inout << counter++;
inout.close();
return 0;
}