1章习题
一、选择题
1A  2D  3C  4D  5B  6C  7C  8B  9B  10A
二、填空题
1、一,函数体
2main()main()
3、编译,目标
4.c.obj.exe
5、缩进,无影响,/*  */
三、程序分析题
1
*****************
         Very good!
    *****************
 
2
    a=12,b=5
    a=17,b=22
 
3
r= 5.50,s=95.033098
 
四、编程题
1.用printf()函数在屏幕上输出自己的班级、学号、。
#include"stdio.h"
void main()
{
 printf("班级:BX1109\n");
    printf("学号:1\n");
    printf(":王孟荣\n");
}
 
 
 
 
 
 
2.从键盘输入两个整数,计算它们的和、差、积、商,并在屏幕上输出结果。
 
#include<stdio.h>
void main()
{
int x,y,a,b,c;
float d;
printf("Please Input Two Integers:\n");
scanf("%d%d",&x,&y);
a=x+y;
b=x-y;
c=x*y;
d=1.0*x/y;
printf("a=%d\nb=%d\nc=%d\nd=%f\n",a,b,c,d);
}
 
 
2章习题
一、选择题
15   BCDCD
610  DBBCA
二、填空题
1.单精度浮点型、双精度浮点型、字符型
20
3x%10*10+x/10
45.5
55.7   20
6sin(sqrt(x*x))/(a*b)
7 
81111011   173  7B
93   3
103
三、程序分析题
1 7,8,10
2 1,3
3.   5  F
4 (int)i=12, 
12.50
5 4c++string类型
61
57
9
112
四、编程题
1.编写程序,求表达式c=21%9-(float)a+4/b*b的值,假设表达式中ab的值分别由键盘输入。
#include<stdio.h>
void main( )
 {
    int a,b;
    float c;
    printf("Please input data a,b: ");
    scanf("%d%d",&a,&b);
    c=21%9-(float)a+4/b*b;
    printf("c=%5.2f\n", c);
 }
2. 编写程序,从键盘输入两个整数存入变量ab中,求a2-b2的值并输出。
   #include<stdio.h>
void main( )
 {
    int a,b,c;
    printf("Please input data a,b: ");
    scanf("%d%d",&a,&b);
    c=a*a-b*b;
    printf("c=%d\n", c);
 }
 
3章习题
一、选择题
1
2
3
4
5
6
7
8
9
10
D
C
AB
A
B
B
BC
B
D
D
 
二、填空题
1. 有穷性 确定性 可行性
2.  #
3. 从终端(键盘)输入一个字符
4.  m   d
5.  97g
6.  123.456000,   123.46, 123
7. 格式控制符不正确(输入数据时不能控制列宽和小数位数)
8. 63,63,77,3f
9. %f%f  &x,&y
10. <stdio.h>   ch   ch
三、程序分析题
1. c=11
2. a=123  f=457
3. x=345
  y=3.460000
4. a=1,b=3
  a=3,b=1
5. (题目需修改为:从键盘输入一个除az以外的小写字母)
程序的功能:从键盘输入一个除az以外的小写字母,求出该字母对应的大写字母的前趋和后继字母,然后顺序输出此三个大写字母,每个字母所占列宽为3
运行结果: 假如输入:f '

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。