Oh man i posted the wrong program...after i was looking at it, I said to myself..thats not it... well here is the right one, i tried doing
Code:
("C://studenttests.dat")
but still nothing Sorry for that mistake Here is the real program and what the input file really is..
Smith Bill 85 75 74
Jones Ann 100 70 80
Walker Thomas 30 90 92
Code:
#include <iostream>
#include <string>
#include <fstream>
#include <iomanip>
using namespace std;
int main ()
{
float lastn1,firstn1, t1,t2,t3, lastn2, firstn2, t21,t22,t23,lastn3, firstn3
,t31,t32,t33, avg1,avg2,avg3;
ifstream inFile;
inFile.open("C:\\studenttests.dat");
inFile >> lastn1 >> firstn1 >> t1 >> t2 >> t3 >> lastn2 >> firstn2 >> t21 >>
t22 >> t23 >> lastn3 >> firstn3 >> t31 >> t32 >> t33;
if (! inFile)
{
cout << "Cant find file joe...." << endl;
return 0;
}
avg1 = (t1+t2+t3)/3;
avg2 = (t21+t22+t23)/3;
avg3 = (t31+t32+t33)/3;
cout << setprecision(2);
cout << " S T U D E N T G R A D E R E P O R T";
cout << endl << endl;
cout << "STUDENT TEST TEST TEST FINAL";
cout << endl;
cout << " NAME ONE TWO THREE AVG" << endl;
cout << endl;
cout << setw(3) << avg1;
cout << "lastn1", "firstn1";
cout << avg1, avg2, avg3;
return 0;
}
And this is what it SHOULD look like...
Code:
S T U D E N T G R A D E R E P O R T
STUDENT TEST TEST TEST FINAL
NAME ONE TWO THREE AVG
BILL SMITH 85 75 74 78.0
ANN JONES 100 70 80 83.3
THOMAS WALKER 30 90 92 70.7
AVERAGE 71.7 78.3 82.0 73.3