簡單題。
程式碼:
#include <iostream>
using namespace std;
int main()
{
const int SCALE = 6;
int grade, studentGrades[SCALE] = { 0 };
while (cin >> grade) // record inputs
{
studentGrades[grade]++;
}
for (int i = 0; i < SCALE; i++)
{
cout << studentGrades[i] << " grade(s) of " << i << endl;
}
return 0;
}
沒有留言:
張貼留言