红皮书 - C语言程序设计实用教程参考答案(2)

2020-02-22 12:04

}

putchar(letter3+32); putchar(letter4+32); putchar(letter5+32); putchar('\\n'); return 0;

习题4

1.(A) 76 (B) 7 (C) 22 (D) 3.5

2.(A) 9 (B) 8 (C) 7 (D) 6 3.B

4. (A) 12 (B) 13 (C) 12.08 (D) 20.0 5. (B) 3 6. (A) 72

7. (D) 2*x, x += 2 8. (C) c<'Z' && c >= 65 9.

3,1 3,1 0,3,1 1,3,1 10.c,c,c 99,99,99 11.x=7,y=3 z=18 12.T

0 1 1

13.一共4条语句 14.

#include

int main(){

int a,b,c;

double result;

printf(\请从键盘输入a,b,c的值,数之间用空格或回车分隔:\\n\ scanf(\ result =2.0/3*a+5.0/6*b+6.0/7*c; printf(\ printf(\ return 0;

} 15.

#include

int main(){

int number; short position1,position2,position3,position4 ; printf(\请从键盘输入number的值:\

scanf(\position4 =number/1000; position2 =number0/10;

position3 =number00/100;

position1 =number; printf(\中个位上的数字是%d\\n\ }

printf(\中十位上的数字是%d\\n\printf(\中百位上的数字是%d\\n\printf(\中千位上的数字是%d\\n\return 0;

习题5

1.y = 100;;处多了一个分号。

2.(A)_10,129___(B)2,-129__(C)__55,129___(D)_2,0_ 3. Tiger

#include int main() {

int x = 10; if(x >= 0){ if(x>0){ printf(\ } else{ printf(\ }

} else{ printf(\ }

return 0; } 4. 30。

5.BAAA 6.

#include int main(){ int a,b,c,d; int temp; int count = 0; printf(\输入a,b,c,d的值,用空格或回车分隔:\ scanf(\ if(a>b) { temp = a; a = b; b = temp; count++; printf(\第%d次排序结果:a=%d,b=%d,c=%d,d=%d\\n\ }

if(a>c) { temp = a; a = c; c = temp; count++;

printf(\第%d次排序结果:a=%d,b=%d,c=%d,d=%d\\n\ }

if(a>d) { temp = a; a = d; d = temp; count++; printf(\第%d次排序结果:a=%d,b=%d,c=%d,d=%d\\n\ } if(b>c) { temp = b; b = c; c = temp; count++; printf(\第%d次排序结果:a=%d,b=%d,c=%d,d=%d\\n\ } if(b>d) { temp = b; b = d; d = temp; count++; printf(\第%d次排序结果:a=%d,b=%d,c=%d,d=%d\\n\ } if(c>d) { temp = c; c = d; d = temp; count++; printf(\第%d次排序结果:a=%d,b=%d,c=%d,d=%d\\n\ } if(count == 0) { printf(\ } return 0; } 7.

#include int main(){ int score; printf(\输入学生成绩的值(1~100之间),用空格或回车分隔:\ scanf(\ if(score>=90) {


红皮书 - C语言程序设计实用教程参考答案(2).doc 将本文的Word文档下载到电脑 下载失败或者文档不完整,请联系客服人员解决!

下一篇:项目融资计划书模板

相关阅读
本类排行
× 注册会员免费下载(下载后可以自由复制和排版)

马上注册会员

注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信: QQ: