[求助]这个程序怎么样才能average=三个score相加的平均值
#include<iostream.h>
#include<stdio.h>
struct student
{
int num;
char name[20];
float score[3];
float average[1];
};
void main()
{
student stud[1];
for(int i=0;i<1;i++)
{ cout<<"please enter the number:";
cin>>stud[i].num;
cout<<"please enter the name:";
cin>>stud[i].name;
for(int j=0;j<3;j++)
{cout<<"please enter the score:";
cin>>stud[i].score[j];}
stud[i].average[i]=(stud[i].score[0]+stud[i].score[1]+stud[i].score[2])/3;}
printf("name=%s\tscore=%f",stud[i].name,stud[i].score);
printf("average=%.1f",stud[i].average[i]);
}
这一段好像没有运算,怎么回事?stud[i].average[i]=(stud[i].score[0]+stud[i].score[1]+stud[i].score[2])/3;}