haixinxin 发表于 2023-6-20 14:52:31

0.         9个A
1.        11个B
2.        C B A
3.        c=9b=5a=16
4.        ?

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

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++;
        goto    readin;
       

xxcxxc 发表于 2023-6-21 10:31:17

1

allgive 发表于 2023-6-24 19:42:30

会不了一点

Tangxilin 发表于 2023-6-26 15:58:52

1

colinl 发表于 2023-6-28 11:56:35

0.0

lyjxx 发表于 2023-6-29 16:44:29

{:5_90:}

Kenzo_Tenma 发表于 2023-6-30 15:06:41

加油

舟小米 发表于 2023-7-2 16:16:38

看答案

失掉自我 发表于 2023-7-5 21:32:02


编程一小白 发表于 2023-7-6 00:48:06

答案

开心的旺仔 发表于 2023-7-6 10:10:34

还要花钱吗

老妮可 发表于 2023-7-9 22:31:35

0.10
1.10
2.a,b,c
3.14,5,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
while(score >= 0)
{
        count++;
        scanf("%d", &score);
}
printf("count = %d\n", count);

0.
#include <stdio.h>

int main()
{
        double xjy = 10000,hy = 10000;
        int year = 0;
        while(xjy >= hy)
        {
                year++;
                xjy = xjy + 10000 * 0.1;
                hy = hy * 1.05;
        }
        printf("%d年后,黑夜的投资额超过小甲鱼!\n",year);
        printf("小甲鱼的投资额是:%.2f\n",xjy);
        printf("黑夜的投资额是:%.2f\n",hy);
       
        return 0;
}

1.
#include <stdio.h>

int main()
{
        int year = 0;
        double money = 4000000;
        while(money > 0)
        {
                money = (money - 500000) * 1.08;
                year++;
        }
        printf("%d年之后,小甲鱼败光了所有的家产,再次回到一贫如洗......\n",year);
       
        return 0;
}

2.
#include <stdio.h>
#include <math.h>

int main()
{
        double i = 1,pi = 0,j = 3;
        while(fabs(i) > (10^(-8)))
        {
                pi += i;
                i = -i / j;
                j += 2;
        }
        printf("%f",pi * 4);
       
        return 0;
}

3.

992957977 发表于 2023-7-10 15:37:22

谢谢

陈9527 发表于 2023-7-10 18:01:11

10个
0
a,b,c
14 5 9
if (size > 12)
{
      goto cost = cost * 1.05;
      flag = 2;
}
if (ibex > 14)
{
      goto sheds = 3;
}
sheds = 2;
readin: scanf("%d", &score);
if (score < 0)
{
      goto printf("count = %d\n", count);
}
count++;

lsy99 发表于 2023-7-11 09:21:29

1

lsy99 发表于 2023-7-11 10:26:44

甲鱼老师,为什么我写的计算pi的代码是错误的?我尝试过把temp=1/i;改为temp=1/(double)i;但那样只会进入死循环,好想好想知道是哪里出了问题啊啊啊啊啊。另外我发现,只要我使用for进行循环,总是多多少少有问题,这个for函数真难啊!!!
#include <stdio.h>
#include <math.h>

int main()
{
    int i;
    double temp, pi=0.0;
    for(i=1;;i+=2)
    {
      if(i%4==3)
      {
            i = -i;
      }
      temp = 1/i;
      if(fabs(temp) > 1e-7)
      {
            pi = pi + temp;
      }
      else
      {
            break;
      }
    }
    pi = pi*4;
    printf("pi=%.7f",pi);
    return 0;
}

阿钧 发表于 2023-7-11 17:56:18

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

B:
if (ibex)
{
        sheds = 3;
}
else
{
        sheds = 2;
        help = 2 * sheds;
}

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

Chris_Ye 发表于 2023-7-11 23:38:31

呀哈哈

Crory 发表于 2023-7-13 10:58:49

{:5_98:}

Iloveyoupython 发表于 2023-7-13 18:13:30

1
页: 252 253 254 255 256 257 258 259 260 261 [262] 263 264 265 266 267 268 269 270 271
查看完整版本: S1E16:拾遗 | 课后测试题及答案