i new in this section
i have a doubt;
im trying to find the student average on my execise,here a copy
Expand|Select|Wrap|Line Numbers
- #include <cstdlib>
- #include <iostream>
- #include <fstream>
- #include <string>
- using namespace std;
- int main(int argc, char *argv[])
- {
- ifstream infile;
- ofstream outfile;
- infile.open("filein.dat");
- outfile.open("outrep.txt");
- outfile << "\t\t\t TURABO UNIVERSITY" << endl;
- outfile << "\t\t\tGRADE AVERAGE\n" << endl;
- outfile << "\tSTUDENT" << "\t\tFIRST" << "\t\tSECOND" << "\t\tTHIRD" << "\t\tSTUDENT" << endl;
- outfile << "\tNUMBER" << "\t\tExam" << "\t\tExam" << "\t\tExam" << "\t\tAVERAGE" << endl;
- while (infile)
- string sn;
- int sn;
- int fe=00;
- int se=00;
- int te=00;
- int st=00;
- float avr=00.0;
- float cavr=00;
- sn=458;
- fe=90;
- se=85;
- te=75;
- avr=fe+se+te/3;
- cavr=cavr+avr;
- outfile << "\t" << sn << "\t\t" << fe << "\t\t" << se << "\t\t" << te << endl;
- sn=459;
- fe=100;
- se=88;
- te=78;
- avr=fe+se+te/3;
- cavr=cavr+avr;
- outfile << "\t" << sn << "\t\t" << fe << "\t\t" << se << "\t\t" << te << endl;
- sn=4510;
- fe=67;
- se=90;
- te=99;
- avr=fe+se+te/3;
- outfile << "\t" << sn << "\t\t" << fe << "\t\t" << se << "\t\t" << te << endl;
- st=st+3;
- cavr=cavr+avr;
- outfile << "\tSTUDENT TOTAL: " << st << endl << endl;
- outfile << "\tCLASS AVERAGE: " << cavr << endl << endl;
- system("PAUSE");
- return EXIT_SUCCESS;