书上例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/07/14 02:39:01
![书上例11.5,因为看不懂例题,所以根本就不知道错哪了 #include #define FORMAT](/uploads/image/z/1117405-37-5.jpg?t=%E4%B9%A6%E4%B8%8A%E4%BE%8B11.5%2C%E5%9B%A0%E4%B8%BA%E7%9C%8B%E4%B8%8D%E6%87%82%E4%BE%8B%E9%A2%98%2C%E6%89%80%E4%BB%A5%E6%A0%B9%E6%9C%AC%E5%B0%B1%E4%B8%8D%E7%9F%A5%E9%81%93%E9%94%99%E5%93%AA%E4%BA%86+%23include+%23define+FORMAT%22%25d%5Cn%25s%5Cn%25f%5Cn%25f%5Cn%25f%5Cn%22+struct+student+%7Bint+num%3B+char+name%5B20%5D%3B+float+score%5B3%5D%3B+%7D%3B+main%28%29+%7Bvoid+print%28struct+student%29%3B+struct+student+stu%3B+stu.num%3D12345%3B+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; 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”就可以了.编程要有耐心,也要细心.为了强调,用了大写.