方圆十米 发表于 2025-2-13 10:10:40

抱抱丘丘 发表于 2025-2-14 11:16:16

abc114255 发表于 2025-2-14 16:16:18

好耶

golife 发表于 2025-2-15 18:28:24

0

pyzyd 发表于 2025-2-17 13:38:17

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

bill = cost * flag;
B:
if (ibex > 14)
{
        sheds = 3;
}
else
{
        sheds = 2;
}
help = 2 * sheds;
       
C,
do {
        scanf("%d", &score);
        count++;
} while (score > 0);
printf("count = %d\n", count);

0.
#include <stdio.h>
#include <math.h>
int main()
{
        double money = 10000;
        double xjy, hy;
        int time = 0;
        xjy = 10000, hy = 10000;
        while (1)
        {
                if (xjy < hy)
                {
                        break;
                }
                xjy = 10000, hy = 10000;
                xjy = xjy + money * 0.10 * time;
                hy = hy * pow(1 + 0.05, time);
                time++;
        }
        printf("%d年后,黑夜的投资额超过小甲鱼 !\n", time);
        printf("小甲鱼的投资额是:%.2lf\n", xjy);
        printf("黑夜的投资额是:%.2lf\n", hy);
        return 0;
}

1.
#include <stdio.h>
int main()
{
        double money = 4000000;
        int time = 0;
        while (money > 0)
        {
                money -= 500000;
                money += money * 0.08;
                time++;
        }
        printf("%d年之后,小甲鱼败光了所有的家产,再次回到一贫如洗......", time);
        return 0;
}
2.
#include <stdio.h>
#include <math.h>
int main()
{
        int i, sign = 1;
        double pi = 0, s = 1;
        for (i = 1; fabs(s) > 1 / 1e8; i += 2)
        {
                s = sign * (1.0 / i);
                sign *= -1;
                pi += s;
        }
        pi = 4 * pi;
        printf("pi = %.7lf", pi);
        return 0;
}
3.
#include <stdio.h>
int main()
{
        int a = 0, b = 1;
        int i;
        for (i = 0; i < 24; i++)
        {
                int t = b;
                b = a + b;
                a = t;
        }
        printf("两年后有%d对兔子", b);
        return 0;
}

3217428159 发表于 2025-2-18 17:01:47

1

我是阿睿啊~ 发表于 2025-2-20 12:42:39

1

雅思寺芽 发表于 2025-2-21 20:42:29

11

小筱小 发表于 2025-3-1 15:32:21

0.10
1.9
2.a
3.14,5,9
4.z=x<0?-x:x;
5.已完成

0.

Noahh 发表于 2025-3-1 16:34:48

0.报错或者100
1.11个
2.a=b=c
3.4 4 11
4.
5.

北孚jo 发表于 2025-3-1 17:03:46

0. 100个'A'

1. 11个'B'

2.a

3. a = 14   , b = 4   , c = 10

4. z = x > 0; x : abs(x);

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

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

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

tyjzyl 发表于 2025-3-2 15:51:39

weth 发表于 2025-3-2 17:42:42

1

couchpotato 发表于 2025-3-3 14:41:30

6

学编程的ff 发表于 2025-3-4 13:03:40

111

yuwuming 发表于 2025-3-5 16:29:08

0.10个A
1.0个B
2."l-value"分别是a,b,c
3.a=14,b=5,c=9
4.z = x>0 ? x : -x;
5.A.
if (size > 12)
{
         cost = cost * 1.05;
         flag = 2;
}
else
{
         bill = cost * flag;
}

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

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

YanShuu 发表于 2025-3-8 22:29:14

对答案

任凭东曦 发表于 2025-3-9 21:01:52


Hu3280165314 发表于 2025-3-11 09:36:56

1

总想惠 发表于 2025-3-11 17:05:50

100
11
if(size>12){
cost=cost*1.05
flag=2
break;}
bill=cost*flag;


页: 276 277 278 279 280 281 282 283 284 285 [286] 287 288
查看完整版本: S1E16:拾遗 | 课后测试题及答案