#include<stdio.h>
main()
{int i;
struct contractinfor
{char num[9];
char name[8];
int chinese;
int english;
int mash;
int sum;
int score;
}studern[10];
for(i=0;i<10;i++)
{printf("\n please put the student number\n");
scanf("%s",studern[i].num);
printf("\n please put the student name\n");
scanf("%s",studern[i].name);
printf("\n please put the student chinese\n");
scanf("%d",studern[i].chinese);
printf("\n please put the student english\n");
scanf("%d",studern[i].english);
printf("\n please put the student mash \n");
scanf("%d",studern[i].mash);
studern[i].sum=studern[i].chinese+studern[i].english+studern[i].mash;
studern[i].score=studern[i].sum/3;
}
for(i=0;i<10;i++)
{printf( "please put the student number=%s",studern[i].num);
printf( "please put the student name=%s",studern[i].name);
printf( "please put the student sum=%d",studern[i].sum);
printf( "please put the student score=%d",studern[i].score);
}
}
取地址符呢?吃了?
另外,\n也吃了...
对你程序的改进
#include<stdio.h>输出结果: