作业帮 > 综合 > 作业

书上例11.5,因为看不懂例题,所以根本就不知道错哪了

来源:学生作业帮 编辑:作业帮 分类:综合作业 时间:2024/07/09 08:02:40
书上例11.5,因为看不懂例题,所以根本就不知道错哪了
#include
#define FORMAT"%d\n%s\n%f\n%f\n%f\n"
struct student
{int num;
char name[20];
float score[3];
};
main()
{void print(struct student);
struct student stu;
stu.num=12345;
strcpy(stu.name,"li li");
stu.score[0]=67.5;
stu.score[1]=89;
stu.score[2]=78.6;
print(stu);
}
void print(struct student stu)
{print(FORMAT,stu.num,stu.name,stu.score[0],stu.score[1],stu.score[2]);
printf("\n");
getch();
}
再帮我看看错哪了?
void print(struct student stu)
{
printf(FORMAT,stu.num,stu.name,stu.score[0],stu.score[1],stu.score[2]);
printf("\n");
getch();
}
在函数的开始的那个“PRINT”应该为“PRINTF”就可以了.编程要有耐心,也要细心.为了强调,用了大写.