Sorry to revisit this subject, but I have another question with I/O files. Do I need to have both *ifstream* & *ofstream* statements in order to reopen a file? The first part worked just fine, but the second part did not reopen the file to write the lowest numbers.

If I change from *b_file* to *e_file* in the second part, I get an *e_file is undefined* error. Is it the *ifstream* statement that DEFINES the file & opens it for reading?

My first part is:
Code:
ofstream d_file ( "D:\\1_LotteryPrograms\\1_Fla_Mega_Money\\High_Freq.txt" );

if (! d_file )
{
cout << "Can't open input file " << endl << endl;
cin.get();
exit(1);
}

d_file << "The 4 numbers having the Highest Frequencies are:" << endl << endl;
d_file << indexoffirst+1 << " = " << first << ",  " << indexofsecond+1 << " = " << second << ",  " << indexofthird+1 << " = " << third << ",  " << indexoffourth+1 << " = " << fourth << endl <<endl;
d_file << endl << endl;

d_file.close();   // Close the file stream explicitly

cout << "The 4 numbers having the Lowest Frequencies are:" << endl << endl;
cout << indexoflowest+1 << " = " << lowest << ", " << indexofsecondlowest+1 << " = " << secondlowest << ", " << indexofthirdlowest+1 << " = " << thirdlowest << ", " << indexoffourthlowest+1 << " = " << fourthlowest << endl <<endl;
My second part is:
Code:
    
ofstream out1;
out1.open ( "D:\\1_LotteryPrograms\\1_Fla_Mega_Money\\High_Freq.txt" );

if (! d_file )
{
cout << "Can't open input file " << endl << endl;
cin.get();
exit(1);
}

d_file << "The 4 numbers having the Highest Frequencies are:" << endl << endl;
d_file << indexoffirst+1 << " = " << first << ",  " << indexofsecond+1 << " = " << second << ",  " << indexofthird+1 << " = " << third << ",  " << indexoffourth+1 << " = " << fourth << endl <<endl;
d_file << endl << endl;

d_file.close();   // Close the file stream explicitly