i want to do a program that:
* Opens a file named lettergrades.txt on the C drive. (lettergrades.txt contains a single line with four characters in it. Each character is either an A, B, C, D or F. Each character is separated by a space.)
*Checks to make sure that file is open before reading from it, otherwise displays a useful message.
*Reads in all the grades.
* Determines the point value of the letter grade. A = 4.0, B = 3.0, C = 2.0, D = 1.0, F = 0.0.
*Closes the file.
*Adds all points together and divides by 4.
*Displays the grade point average to the screen.
can anyone explain to me what i have to do, PLEASE!!!!
this is what i have
#include <cstdlib>
#include <iostream>
#include <cmath>
#include <fstream>
using namespace std;
int main(int argc, char *argv[])
{
ifstream infile;
ofstream outfile;
char lettergrade[4];
double average;
infile.open ("C:// lettergrades. Txt");
infile >> lettergrade;
infile >> average;
while ( !infile.eof())
infile >> lettergrade >> average;
outfile << lettergrade << " " << average/4 << endl;
outfile.close();
system("PAUSE");
}