1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
|
#include <iostream>
#include <iomanip>
const int Size = 20;
using namespace std;
void main()
{
// This is suppose to be done by cin...
float enrollment_number[Size] = {145690, 176899, 678191, 145670, 234760,
389156, 456800, 776541, 345689, 222345,
156456, 485912, 456982, 445628, 123981,
456720, 567234, 356709, 765123, 267810};
float score[Size] = { 89.00, 45.50, 12.00, 96.00, 60.00,
78.50, 54.50, 80.00, 30.00, 36.50,
56.50, 22.00, 67.00, 87.00, 78.00,
67.80, 70.00, 74.00, 90.00, 81.00 };
string grade[Size] = { "A", "C", "F", "A", "B",
"A-", "C+", "A", "D", "D+",
"B-", "D-", "B+", "A", "A-",
"B+", "A-", "A-", "A", "A" };
cout << setw(80) << setfill('-') << "\n";
cout << setfill(' ') << "No." << setw(7) << "|Name" << setw(20) << "|Score" << setw(20) << "|Grade\n";
cout << setw(80) << setfill('-') << "\n";
// This is the where the problem starts...
for (int i = 0; i < Size; i++)
{
cout << setfill(' ') << i+1 << "." << setw(10) << enrollment_number[i] << setw(18);
cout << setiosflags(ios::fixed) << setprecision(2) << score[i] << resetiosflags(ios::fixed);
cout << setw(15) << grade[i] << endl;
}
}
|