the code is used to read the text and take the first 4 pieces of info but i do not know how to do it. i have already created the text file and moved it into the source. i am using visual studios 2012. thanks
in 2010 the text file would show a relative path, it doesn't in 2012
ok i got it working!! now i just need to write the contents of the program to an output file which i have no idea how to, can anyone help me with this
thanks again
Writing to an output file is just like writing to cout, except you use the name of the variable for the output file instead. You can open the outfile in a similar way to how you open the input file. I see in the code in your first post you have outFile, but it's of type ifstream instead of ofstream. It needs to be ofstream.
outFile.open("game_totals.txt");
outFile<< //remove this line
if (avg<1000)
{
cout<<name<<" -beginner- Keep Practicing!"; //change 'cout' to 'outFile'
cout<<endl; //change 'cout' to 'outFile'
}
if (avg>1000&&avg<1500)
{
cout<<name<<" -intermediate-"; //change 'cout' to 'outFile'
cout<<endl; //change 'cout' to 'outFile'
}
if (avg>1500)
{
cout<<name<<" -advanced- Good Job!"; //change 'cout' to 'outFile'
cout< <endl; //change 'cout' to 'outFile'
name; //remove this line
}