#include<stdio.h>
int main()
{
int i,n;
printf("请输入课程数量:");
scanf("%d",&n);
float a[n],b[n],d[n],f[n];
float c=0,e=0,g=0;
printf("\n");
for(i=0; i<n; i++)
{
printf("%d、",i+1);
printf("请输入第%d门科目的成绩:",i+1);
scanf("%f",&a[i]);
if(a[i]<60)
a[i]=50;
printf(" 请输入第%d门科目的学分:",i+1);
scanf("%f",&b[i]);
printf("\n");
}
for(i=0; i<n; i++)
{
c=c+b[i];
d[i]=(a[i]-50)/10;
e=e+d[i];
f[i]=d[i]*b[i];
g=g+f[i];
}
for(i=0; i<n; i++)
{
printf("第%d门:\n",i+1);
printf("成绩:%.1f\n",a[i]);
printf("学分:%.1f\n",b[i]);
printf("绩点:%.2f\n",d[i]);
printf("学分绩点:%.2f\n",b[i]*d[i]);
printf("\n");
}
printf("--------结果--------\n");
printf("总学分:%.1f\n",c);
printf("总绩点:%.2f\n",e);
printf("总学分绩点:%.2f\n",g);
printf("平均学分绩点:%.3f\n",g/c);
printf("\n");
return 0;
}
10-25
01-12
4932