读程序题:#include main(){ float a,b,c,t; a=3; b=7; c=1;if(a>b) {t=a;a=b;b=t;}if(a>c) {t=a;a=c;c=t;}if(b>c) {t=b;b=c;c=t;}printf("%5.2f,%5.2f,%5.2f",a,b,c);}
查看答案
#include < stdio .h >void main ( ){ float c=3.0 , d=4.0;if ( c>d ) c=5.0;elseif ( c==d ) c=6.0;else c=7.0;printf ( “%.1f\n”,c ) ;}运行结果为_____________________
#include main(){ int m; scanf("%d", &m); if (m >= 0) { if (m%2 == 0) printf("%d is a positive even\n", m); else printf("%d is a positive odd\n", m); } else { if (m % 2 == 0) printf("%d is a negative even\n", m); else printf("%d is a negative odd\n", m); }}若键入-9,则运行结果为:
编程题:利用switch语句实现,输入一周中的某一天,查询这一天是工作日还是周末休息日。提示:查询某一天是工作日还是休息日,一次执行一条指令,可以用switch语句;
编程题:使用switch语句, 做一个值班查询表,周一至周六安排不同的人值夜班,周日不值班。提示:1)周一到周日需要键盘输入,调用scanf()函数2)多种情况的判断,用switch语句