I need to fallow these directions for homework but I'm stuck on some things:
// open output filestream for appending
// get valid file name
ofstream fout( getOutFileName().c_str() );
// if the file opened successfully
if ( fout.good() )
{
cout << " The file was succesfully opened." <<endl;
// repeatedly do the process
Q: What does he mean by repeatedly do the process? And how do I code that in?
// accept data pairs
Q: And this?
// and send each pair to be appended to the output stream
Q: And this?
// until user is finished, then
Q: And this?
// close the output file.
fout.close();
}
else // otherwise
{ // display error message
cout << "The file did not open."
<< endl;
}