I am doing a project that produces a gradebook for an amount of students and exam scores.
the project link is
http://www.ecst.csuchico.edu/~chmorris/csci111/projects/06/
There are some additional things I need to produce besides being able to print the array chart, but I am stuck and have been trying to solve this problem. My current program is prints some of the actual exam scores, mostly garbage numbers, and none of the students names.
Any help is greatly appreciated.
-Matt
Attached is the output that is read from the compiler.
Here is what I have so far:
#include <iostream>
#include <cstring>
#include <string>
#include <fstream>
#include <iomanip>
using namespace std;
int main ()
{
string students[20];
int st_num = 0;
int st_exam= 0;
int st_name = 0;
double exam_ave[11];
int st_total[20];
double st_ave[10];
int score[20][10];
int st_high[10];
int st_low[10];
ifstream input;
string filename;
string name;
char ch;
while (filename != "the_office.csv")
{
cout << "Enter the filename containing exam scores: ";
cin >> filename;
}
input.open(filename);
while(getline(input,students[0],',') )
{
input >> score[st_num][st_exam];
input.get(ch);
st_exam++;
st_num++;
}
cout << "\n" << setw(12) << "Exams |";
for(int i = 1 ; i < 5; i++){
cout << setw(12) << i ;
}
cout << setw(5) << " Total";
cout << endl;
for( int j = 0; j < 5; j++)
{
cout << "---------------";
}
cout << endl;
for (int st_loc =0; st_loc < 20; st_loc++)
{ cout << setw(10) << students[st_loc] << " |";
for (int exam_num = 0; exam_num < 5; exam_num++)
{
cout << setw(5) << score[st_loc][exam_num];
}
cout << endl;
}
cout << endl;
system("PAUSE");
return 0;
}