练习系统 实验一 谁拿了最多的奖学金
2017-02-22 21:37
525 查看
当没这个语句或类似语句,你点开生成的.exe文件,运行界面只会闪一下,而有这个语句,就不会了!类似语句还有getchar();在最后加上这种语句,你就可以看到运行结果了 #include<stdio.h> //#include<stdlib.h> struct students { char name[21]; int score1, score2; char c1, c2; int num, money; }student[100]; void judge ( struct students * sb ) { if ( sb->score1 >80 && sb->num>=1 ) sb->money += 8000; if ( sb->score1 >85 && sb->score2>80 ) sb->money += 4000; if ( sb->score1 >90 ) sb->money += 2000; if ( sb->score1 >85 && sb->c2=='Y' ) sb->money += 1000; if ( sb->score2 >80 && sb->c1=='Y' ) sb->money += 850; } int main() { int n; scanf ( "%d", &n ); int i, j, sum = 0; for ( i=0; i<n; i++ ) { scanf ( "%s", student[i].name ); scanf ( "%d%d", &student[i].score1, &student[i].score2 ); scanf ( " %c %c", &student[i].c1, &student[i].c2 ); scanf ( "%d", &student[i].num ); student[i].money = 0; judge( &student[i] ); sum += student[i].money; } int max = student[0].money; j = 0; for ( i=1; i<n; i++ ) { if ( student[i].money > max ) { max = student[i].money ; j = i; } } printf ( "%s\n%d\n%d\n", student[j].name, student[j].money, sum ); //system("pause"); return 0; } |
相关文章推荐
- 练习系统 实验一 填词
- 练习系统 实验一 简单密码
- 练习系统 实验三 赋值问题
- Android Studio Okhttp3医院预约挂号系统练习实验程序Android客户端+JSP Servlet服务器端
- 练习系统 实验四 red and black
- Java程序练习-谁拿了最多奖学金
- 练习系统 实验三 菲波那契数列
- 练习系统 实验三 大整数除法
- 练习系统 实验一 化验诊断
- 练习系统 实验二 不吉利日期
- 练习系统 实验二 字符串判等
- 练习系统 实验三 求大整数的阶乘
- 练习系统 实验三 大整数乘法
- 练习系统 实验一 垂直直方图
- 练习系统 实验二 电话号码
- 练习系统 实验二 All in All
- 练习系统 实验四 放苹果
- 练习系统 实验三 数字三角形
- 练习系统 实验四 八皇后(枚举法)
- 练习系统 实验二 十进制到R进制