|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
- #include <stdio.h>
- struct
- {
- int num;
- char *name;
- int C_score;
- int com_score;
- int PS_score;
- int spor_score;
- int English_score;
- }student;
- int main()
- {
- int max = 0;
- char ch[20];
- printf("请输入学号:");
- scanf("%d", &student.num);
- printf("请输入姓名:");
- scanf("%s", &student.name);
- printf("请输入C语言成绩:");
- scanf("%d", &student.C_score);
- if(student.C_score > max)
- {
- max = student.C_score;
- }
- printf("请输入计算机应用成绩:");
- scanf("%d", &student.com_score);
- if(student.com_score > max)
- {
- max = student.com_score;
- }
- printf("请输入PS成绩:");
- scanf("%d", &student.PS_score);
- if(student.PS_score > max);
- {
- max = student.PS_score;
- }
- printf("请输入体育成绩:");
- scanf("%d", &student.spor_score);
- if(student.spor_score > max)
- {
- max = student.spor_score;
- }
- printf("请输入英语成绩:");
- scanf("%d", &student.English_score);
- if(student.English_score > max)
- {
- max = student.English_score;
- }
- printf("score max = %d\n", max);
- return 0;
- }
复制代码
- if(student.PS_score > max);
复制代码
多写了分号,后面的赋值语句变成必执行的了
|
|