int _tmain(int argc, char *argv[]) // <----- if your not going to use args, probably not needed.
{
ofstream taxFile ("Tax.txt"); // <---- this is not a function and therefore does not need a
// function body: No { } needed ... and as already mentioned include closing quotes around
// Tax.txt
if ( ! taxFile.is_open())
{
cerr << "error opening file"
exit (1);
}
else
{
string coE;
cout << "Press 1 for Customer, 2 for Employee, and 3 for End ";
getline(cin, coE);
.... // etc etc
....
}
}
taxfile.close(); // <----- this should be in function body "main"
#endif // <------ end what if? are you defining something? if so then you may want a ";" at the end or "#" at the start
additionally you should not use uppercase variables for non-constants.
constants in uppercase: const int ARRAYSIZE=34730;
variables in camel case: string firstName, lastName, thisIsACamelCaseStringVariableSee;
When you declare your ofstream and specify it a file name right away it will open it in ios::out mode for you, and the second call to open will fail. Since you need ios::trunc as well you should probably do this instead: