马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
#include<stdio.h>
struct student
{
int num;
char name[20];
float score[3];
};
void main()
{
void print(struct student stu[]);
struct student stu[3];
int i;
printf("请输入3个学生的个人信息:\n");
for(i = 0;i < 3;i++)
scanf("%d%s%f%f%f",&stu[i].num,stu[i].name,&stu[i].score[0],&stu[i].score[1],&stu[i].score[2]);
print(stu);
}
void print(struct student stu[])
{
int i;
for(i = 0;i < 3;i++)
{
printf("num:%d\tname:%s\tscore:%6.2f,%6.2f,%6.2f\n",stu[i].num,stu[i].name,stu[i].score[0],stu[i].score[1],stu[i].score[2]);
}
}
输入3个学生的信息,只要输入学生名字小于3个字符(stu[i].name = “hu”),打印的时候\t怎么就不起作用。 |