#include <stdio.h>
struct information
{ int num;
char country[30];
char name[40];
float score[5];
float count;
};
for(i=0;i<12;i++)
{scanf("%f",&sportswomen[i].score[0]);
sportswomen[i].count+=sportswomen[i].score[0];}
参考如下:
#include <stdio.h>
struct information
{
int num;
char country[30];
char name[40];
float score[5];
float count;
};
struct information sportswomen[12];
int i,j;
for(i=0;i<12;i++)
{
scanf("%d %s %s",&sportswomen[i].num,sportswomen[i].country,sportswomen[i].name);
for(j=0;j<5;j++)
scanf("%f",&sportswomen[i].score[j]);
scanf("%f",&sportswomen[i].count);
}
循环5次赋值或者依次赋值