书上例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; strc
来源:学生作业帮助网 编辑:六六作业网 时间:2024/11/26 15:16:41
书上例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; strc
书上例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();
}
再帮我看看错哪了?
书上例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; strc
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”就可以了.编程要有耐心,也要细心.为了强调,用了大写.