I have a problem. I got my file to open but I don't know how to modify the file and have the output I need. Here is my code so far

#include <fstream>
#include <iostream>
#include <cstdlib>

int main()
{
    using namespace std;
    ifstream input;
    ofstream output;

    input.open("input.txt");
    if (input.fail())
    {
        cout<<"Input file opening failed.\n";
        exit(1);
    }

    output.open("grade.txt");
    if (output.fail())
    {
        cout<<"Output file opening failed.\n";
        exit(1);
    }

    input.close();
    output.close();

    return 0;
}

i'm supposed to add the total of scores...average them and have the program tell me who has the highest and lowest averages of the students.

Could you post a brief example of the data files...

I have a problem. I got my file to open but I don't know how to modify the file and have the output I need.

Well, the first thing you have to add is reading the file input.txt.

The input file looks like this:

DAN 100 70 85
JANE 78 82 90
PETER 82 84 91
MINIE 98 100 75
JOSEPH 71 62 100
CHRISTOPHER 91 75 82
BEN 54 84 77

After I read the input file and add everything its supposed to have their total, average, letter grade and show us who has the lowest grade and who has the highest grade.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.