C语言答案谭浩强第5章

上传人:nt****6 文档编号:45938838 上传时间:2018-06-20 格式:PDF 页数:10 大小:1.06MB
返回 下载 相关 举报
C语言答案谭浩强第5章_第1页
第1页 / 共10页
C语言答案谭浩强第5章_第2页
第2页 / 共10页
C语言答案谭浩强第5章_第3页
第3页 / 共10页
C语言答案谭浩强第5章_第4页
第4页 / 共10页
C语言答案谭浩强第5章_第5页
第5页 / 共10页
点击查看更多>>
资源描述

《C语言答案谭浩强第5章》由会员分享,可在线阅读,更多相关《C语言答案谭浩强第5章(10页珍藏版)》请在金锄头文库上搜索。

1、 1? 5 ? ? ? ? 5.1 ? ? ? ? 5.2 C ?“?”?“?”?“?”?“?”? ? ? 1 ? ? 0 ? 0 ? ?3 /* ?a?b?temp?*/ max=(tempc)?temp:c; /* ?a?b?c?, ?*/ printf(“max=%dn”, max); ? ?12, 34, 9 max=34 5.5 ? ?100)|(score9999) place=5; else if (num999) place=4; else if (num99) place=3; else if (num9) place=2; 5else place=1; printf(“?=

2、%dn”, place); printf(“?: ”); ten_thousand=num/10000; thousand=(int)(num-ten_thousand*10000)/1000; hundred=(int)( num-ten_thousand*10000-thousand*1000)/100; ten=(int)(num-ten_thousand*10000-thousand*1000-hundred*100)/10; indiv=(int)(num-ten_thousand*10000-thousand*1000-hundred*100-ten*10); switch(pla

3、ce) case 5: printf(“%d, %d, %d, %d, %d”, ten_thousand, thousand, hundred,ten, indiv); printf(“n?: ”); printf(“%d%d%d%d%dn”, indiv, ten, hundred, thousand, ten_thousand); break; case 4: printf(“%d, %d, %d, %d”, thousand, hundred,ten, indiv); printf(“n?: ”); printf(“%d%d%d%dn”, indiv, ten, hundred, th

4、ousand); break; case 3: printf(“%d, %d, %d”, hundred,ten, indiv); printf(“n?: ”); printf(“%d%d%dn”, indiv, ten, hundred); break; case 2: printf(“%d, %d”, ten, indiv); printf(“n?: ”); printf(“%d%dn”, indiv, ten); break; case 1: printf(“%d”, indiv); printf(“n?: ”); printf(“%dn”, indiv); break; ? ?(099

5、999):98765 ?=5 ?: 9, 8, 7, 6, 5 ?:56789 5.7 ?I?10?10? ?10?20?(100000?I?200000)?10?10? 100000?7.5?200000?I?400000?20?6?(?)?20?5?400000?I?600000?40?3 ?600000?I?1000000?60?1.5?I?1000000?100 ?1?I? ?(1)?if?(2)?switch? ? ?1?if?N-S?5.3? ? main() long i; float bonus, bon1, bon2, bon4, bon6, bon10; bon1=1000

6、00*0.1; /* ?10?*/ bon2=bon1+100000*0.075; /* ?20?*/ bon4=bon2+200000*0.05; /* ?40?*/ bon6=bon4+200000*0.03; /* ?60?*/ bon10=bon6+400000*0.015; /* ?100?*/ printf(“?i : ”); scanf(“%ld”, if (i10) c=10; switch(c) case 0: bonus=i*0.1; break; case 1: bonus=bon1+(i-100000)*0.075; break; 8case 2: case 3: bo

7、nus=bon2+(i-200000)*0.05; break; case 4: case 5: bonus=bon4+(i-400000)*0.03; break; case 6: case 7: case 8: case 9: bonus=bon6+(i-600000)*0.015; break; case 10: bonus=bon10+(i-1000000)*0.01; printf(“?: %10.2f”, bonus); ? ?i : 234000 ?: 19200.00 5.9 ?4 ? ? main() int a, b, c, d, t; printf(“?4 ?: ”); scanf(“%d, %d, %d, %d”, printf(“?: n”); printf(“%d, %d, %d, %d”, a, b, c, d); if (ab) t=a; a=b; b=t; if (ac) t=a; a=c; c=t; if (ad) t=a; a=d; d=t; if (bc) t=b; b=c; c=t; if (bd) t=b; b=d; d=t; if (cd) t=c; c=d; d=t; printf(“?: n”); printf(“%d, %d, %d, %d”, a, b, c, d); ?

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 高等教育 > 其它相关文档

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号