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
|
#include <iostream>
using namespace std;
float hqgrade (int arg[])
{
float sum;
float grade;
for (int n=0; n<18; n++)
{
sum = sum + arg[n];
}
grade = sum *100 /180;
return grade;
}
int main ()
{
int hq[] = {10, 9, 8, 7, 8, 9, 10, 10, 9, 8, 7, 8, 9, 10, 10, 9, 9, 10};
cout.precision(2);
cout << fixed << hqgrade(hq);
system ("pause");
return 0;
}
|