I'm trying to create a program, that reads a file, and create an output.
Here's the questions: Write a program to compute numeric grades for a
course. The course records are in a file that will serve as the input
file. The input file is in exactly the following format: Each line
contains a student's last name, then on espace, then the student's
first name, then one space, then ten quiz scores all on one line. The
quiz scores are whole numbers and are separated by one space. Your
program will take its input from this file and send its output to a second
file. The data in the output file will be the same as the data in
the input file except that there will be one additional number ( of type
double ) at the end of each line. This number will be the average of
the student's ten quiz scores. If this is being done as a class
assignment, obtain the file names from your instructor. Use at least
one function that has file streams as all or some of its arguments.
Here's my code, can someone tell me what's the mistake i've done. Currently, it says "Building error", which i can't find my mistakes. :(
#include <iostream>
#include <fstream>
using namespace std;
void calculate(ifstream&, ofstream&);
int main()
{
ifstream in;
ofstream out;
in.open("input.txt");
if(in.fail())
{ cout<<"Input file failed. Please try again or use another file./n";
system("pause");
return 1;
}