void showGradeData(float **scores, int num, float calculatedPointGrade[], char letterGrade[]) // displays the table with students averages and letter score
{
cout<<"|-------------------------------------------------|"<<endl;
cout<<setprecision(1)<<setiosflags(ios::fixed)<<"| SN"<<setw(9)<<"| Exam "<<setw(10)<<"| Lab Ave "<<setw(8)<<"| HW "<<setw(8)<<"| Pts. |"<<setw(10)<<" Grd |"<<endl;
cout<<"|-------------------------------------------------|"<<endl;
for(int i=0;i<num;i++)
{
cout<< "| "<<(i+1)<<setw(5)<<setprecision(1)<<setiosflags(ios::fixed)<<"| "<<scores[i][0]<<setw(3)<<"| "<<scores[i][1]<<setw(8)<<"| "<<scores[i][2];
cout<<setw(5)<<"| "<<calculatedPointGrade[i]<<setw(3)<<"| "<<letterGrade[i]<<" |"<<endl;
}
}
Here is a sample of the output:
Enter number of students: 2
Enter Exam average for Student 1: 100
Enter Lab average for Student 1: 67
Enter Homework average for Student 1: 99
Enter Exam average for Student 2: 77
Enter Lab average for Student 2: 100
Enter Homework average for Student 2: 99
|-------------------------------------------------|
| SN | Exam | Lab Ave | HW | Pts. | Grd |
|-------------------------------------------------|
| 1 | 100.0 | 67.0 | 99.0 | 90.0| B |
| 2 | 77.0 | 100.0 | 99.0 | 86.1| B |
Press any key to continue . . .
Could someone please give me some advice on how to line the columns and rows up...I almost have it completed but when I enter in 100, it moves the columns so they don't line up. I think it's just a setw() problem but I am not exactly sure. Thanks

New Topic/Question
Reply



MultiQuote





|