How do I get this output to a file.....I can get it to print on the screen, but I can't figure it out for the life of me....
#include <iostream>
#include <iomanip>
#include <fstream>
#include <string>
using namespace std;
void abc(ifstream&);
void main()
{
ifstream inFile;
ofstream outFile;
double courseAvg;
int numberoftests;
string Name;
inFile.open("tests.txt");
outFile.open("finalgrades.txt");
numberoftests = 0;
courseAvg = 0.0;
outFile << fixed << showpoint;
outFile << setprecision(1);
if (!inFile)
{
cout << "Cannot open the input file." << endl;
}
else
{
outFile.open("finalgrades.txt");
outFile << fixed << showpoint;
outFile << setprecision(1);
for (int i =1; i <= 10; i++)
{
inFile >> Name;
cout << Name << " ";
outFile << Name << " ";
abc(inFile);
}
}
cin >> Name;
}//End of Main
void abc(ifstream& x)
{
int gr;
for (int i = 1; i <= 5; i++)
{
x >> gr;
cout << " " << gr;
}
cout << endl;
}