Hi all, I am a total newb when it comes to program, I am currently in the process of writing my 3rd super simple program, and I am having a whole bunch of trouble..becuase I am trying to teach myself, and I am lost trying to do this with online tutorials and whatnot
Alright this is my problem...I was given a file from a website....(studenttests.dat) It looked like this...
It gives the students name and his 3 tests scores then his average..
William Billy 79 82 83.5 81.0
Jones Sally 85 90 95 90
Smith Mark 80 80 80.5 80.1
I have to be able to input the file into the program, Be able to calculate a certain students average by giving their name. and the program has to input the first 3 tests scores then average them...For some reason I cannot get the file into the program, I have tried from the A: drive and the C: drive, both to no avail...any help you experts out there could give a rookie like me would be GREAT...this is what I have so far..i know its very simple but like I said...Im a newb,
Code://This program will print out student grade reports. #include <iostream> #include <string> #include <fstream> #include <iomanip> using namespace std; int main () { string FirstName; cout << "What is name of the students test you want?" << endl; cin >> FirstName; t2,t3,LastName; string FirstName; ifstream inFile("C:/studenttests.dat"); >> FirstName >> LastName; if (! inFile) { cout << "Error opening input file" << endl; return -1; } while (inFile.get()); cout << inFile.get(); cout << fixed << showpoint; cout << setprecision (2); cout << " S T U D E N T G R A D E R E P O R T S" ; cout << endl; cout << endl; cout << "STUDENT TEST TEST TEST FINAL" <<endl; cout << " NAME ONE TWO THREE AVG" <<endl; cout << endl; cout << endl << endl; return 0; }



LinkBack URL
About LinkBacks


