zhoujie13 发表于 2018-3-2 22:47:07

哈哈哈哈哈哈哈哈哈

cherishzmy007 发表于 2018-3-3 13:19:31

0

nightamber 发表于 2018-3-3 20:27:53

完成

Jackf 发表于 2018-3-4 09:59:25

最后一题为46368

wuqi123 发表于 2018-3-5 11:22:17

谢谢

mrblbl 发表于 2018-3-6 14:59:10

view

kedobi 发表于 2018-3-6 16:46:19

我是过来看答案的

butters33 发表于 2018-3-6 17:13:08

#include<stdio.h>
int main()
{
        double x,x_1,xiao = 10000,h = 10000;
        int i = 1;
        for (;;i++)
        {
                x = xiao * 0.1;
                x_1 = x * i + xiao;
                h = h * (1+0.05);
                if (h > x_1)
                break;
        }
        printf("%d年后\n小甲鱼%.2f\n黑夜%.2f\n",i,x_1,h);
        return 0;
}

iris14 发表于 2018-3-6 22:40:32

0. 10个
1. 10个
2. a b c
3.a=14b=4c=10
4. x>0?z=x:z=-x;
5.
A    if(size>12)
{
    cost=cost*1.05;
    flag=2;
}
bill=cost*flag;

Bif(ibex>14)
{
    sheds = 3;
}
else
{
    sheds = 2;
    help=2*sheds;
}

Cif(score<0)
{
    printf("count=%d\n",count);
count++;
scanf("%d",&score);

blablabla 发表于 2018-3-7 14:05:24

哈哈哈哈

hhloverr 发表于 2018-3-7 18:15:20

想知道

466628330 发表于 2018-3-8 11:40:49

0.如果正,负号运算符的优先级低于加,减号运算符, 那么 -3 + 5 的值应该是多少?

答: -(3+5),先进行3+5的运算再取负值, 答案为-8;

1.请问下买你的程序会显示什么内容?
#include <stdio.h>

int main()
{
      int a = 2, b = 1;

      printf("%d\n", a / 'b');

      return 0;      
}

答:a / 'b' 为 a / 66 => 2 / 66, 为一个0.0n的小数, 输出为按整数输出, 整数位为零, 所以输出为0

2.如果不上机实验, 你知道下边的代码输出的是什么吗?
#include <stdio.h>

int main()
{
      int a;
      (a = 2) + 3 * 4;
      printf("a = %d\n", a);

      return 0;
}

答: 输出的是
a = 2
原因是:(a = 2) + 3 * 4; 这个语句中是把2的值赋给a

3.请写出下边表达式的值(如果结果为浮点数,请保留6位小数):
A.5 / 3
B.1 / 0
C.1.2 + 3
D.1.2 * 0
E.6.0 / 2
F.10 / 6.0
G. 3 / 5
答:
A.1
B.语法错误
C.4.2
D.0.0
E.3.0
F.1.33
G.0

4.下边代码中存在两处错误,请指出:
#include <stdio.h>

int main()
{
      int a = (5 + 1.2) % 2;        //右值为浮点数, 但是变量a是整型
      printf("%d\n", a);                //按照整型输出有问题
}
答: 详见注释

5.C语言其实在大部分情况下不用goto也能做的很好,请尝试将下列代码写成不带goto的版本
A.
if (size > 12)
{
      goto a;
}
goto b;
a:      cost = cost * 1.05;
      flag = 2;
b:      bill = cost * flag;

B.
if (ibex > 14)
{
      goto a;
}
sheds = 2;
goto b;
a:      sheds = 3;
b:      help = 2 * sheds;

C.
readin: scanf("%d", &score);
if (score < 0)
{
      goto stage2;
}
count++;
goto    readin;
stage2: printf("count = %d\n", count);

答:
A.
if (size > 12) {
cost *= 1.05;
flag = 2;
}
bill = cost * flag;

B.
if (ibex > 14)
{
      sheds = 3;
}
sheds = 2;
help = 2 * sheds;

C.
if (score < 0)
{
       printf("count = %d\n", count);
}
count++;
scanf("%d", &score);

lyin3 发表于 2018-3-8 19:44:48

我想知道

fatesept 发表于 2018-3-8 23:09:41

know

李小赖 发表于 2018-3-9 14:13:56

{:5_97:}

蜘蛛X 发表于 2018-3-9 23:02:02

朕想知道

igniculus 发表于 2018-3-10 22:38:57

朕想知道

ImmortalKing 发表于 2018-3-11 03:49:58

惊了我仿佛看见了所有楼层

艾C 发表于 2018-3-11 16:04:34

0

smilepower 发表于 2018-3-11 17:40:38

0.10个A
1.11个B
2.c=5,b=c,a=b
3.z = x>0?x:-x
4.if (size > 12)
{
      cost = cost * 1.05;
      flag = 2;
}
bill = cost * flag;

if (ibex > 14)
{
      sheds = 3;
}
sheds = 2;
help = 2 * sheds;


if (score < 0)
{
      printf("count = %d\n", count);
}
count++;
scanf("%d", &score);
页: 9 10 11 12 13 14 15 16 17 18 [19] 20 21 22 23 24 25 26 27 28
查看完整版本: S1E16:拾遗 | 课后测试题及答案