#include "stdafx.h"
#include <stdio.h>
struct student
{
int num;
int score;
};
int main()
{
int i,j,c=0,n=0;
float ave;
struct student st[30];
printf("学号 成绩\n");
for(i=0;i<30;i++)
{
scanf("%d%d",&st[i].num,&st[i].score);
if(st[i].num<0||st[i].score<0)
break;
ave+=st[i].score;
n++;
}
ave=ave/n;
printf("%.1f\n",ave);
return 0;
}
就是这么个情况,本来题目还有很多的,可是到这里那个平均成绩总是算不出来,哪里错了啊?