编写一个程序,由键盘输入一个学生的5门课程成绩

编写一个程序,由键盘输入一个学生的5门课程成绩,求该学生的总分、平均分、最高分和最低分,并输出。(使用循环结构)

#include<iostream>
using namespace std;

int main()
{
    int i, scores[5], max=0, min=1000;
    float avg, sum = 0.0;
    for (i=0;i<5;i++){
        cin >> scores[i];
    }
    for (i=0;i<5;i++){
        sum += scores[i]*1.0;
        if (max<scores[i])
            max = scores[i];
        if (min>scores[i])
            min = scores[i];
    }
    avg = 0.2*sum;
    cout << "总分:" << sum << endl; 
    cout << "平均分:" << avg << endl;
    cout << "最高分:" << max << endl;
    cout << "最低分:" << min << endl;
    return 0;
}

可以弄一个结构体,把成绩放入结构体里面