xcf85532552 发表于 2017-7-25 11:05:58

看答案咯~~~

berggor 发表于 2017-7-25 11:56:40

看看答案

1762075716 发表于 2017-7-26 21:18:45

0. 100
1. 10
2. a,b,c
3. a = 14,b = 5, c = 9
4. (x>0)?(z=x):(z=-x)
5.A.
if(size > 12){
                cost *= 1.05;
                flag = 2;
}
bill = cost * flag;
B.
if(ibex > 14){
        sheds = 3;
}else{
        sheds = 2;
}
help = 2 * sheds;
C.
scanf("%d",&score);
for(;score >= 0;count++){
        scanf("%d",&score);
}
printf("count = %d\n",count);
0.#include <stdio.h>

int main()
{
        double xiaojiayu = 10000,heiye = 10000;
        int count = 0;
       
        do{
                xiaojiayu = xiaojiayu + 10000 * 0.1;
                heiye = heiye + heiye * 0.05;
                count++;
        }while(heiye < xiaojiayu);
       
        printf("%d年后,黑夜的投资额超过小甲鱼!\n",count);
        printf("小甲鱼的投资额是: %.2lf\n",xiaojiayu);
        printf("黑夜的投资额是: %.2lf\n",heiye);
       
        return 0;
}
1. #include <stdio.h>
#define LL 0.08

int main()
{
        double ck = 400,lx;
        int count = 0;
       
        do{
                ck -= 50;
                ck += ck * LL;
                if(ck <= 0){
                        ck = 0;
                }
                count++;
        }while(ck != 0);
       
        printf("%d年之后,小甲鱼败光了所有家产,再次回到一贫如洗......\n",count);
       
        return 0;
}
2. #include <stdio.h>
#include <math.h>

int main()
{
        double pi = 0,i = 1;
        _Bool flag = 0;
       
        while(fabs(1/i) >= 1.0e-8){
                if(flag){
                        pi += 1 / i * -1;
                }else{
                        pi += 1 / i * 1;
                }
                flag = !flag;
                i += 2;
        }
        pi *= 4;
        printf("pi = %.7lf\n",pi);
       
        return 0;
}
3.#include <stdio.h>

int main()
{
        int month,comp,half_comp,young,i,sum; //i是中间变量
       
        month = 1;//月份
        comp = 0;   //成熟
        half_comp = 0;//半成熟
        young = 1;//年幼
       
        while(month <= 24){
                i = comp;
                comp += half_comp;
                half_comp = young;
                young = i;
                month++;
        }
       
        sum = comp + half_comp + young;
        printf("两年后可以繁殖%d对兔子!\n",sum);
       
        return 0;
}

妳心我为王 发表于 2017-7-27 00:20:33

1

fanzongsao 发表于 2017-7-27 13:02:12

{:10_319:}

qq王子 发表于 2017-7-27 16:37:57

1

qq王子 发表于 2017-7-27 16:46:29

Pi为什么最后要等于pi*4啊,还有fabs是啥- -

丶忘却的年少o 发表于 2017-7-27 16:47:48

核对答案

lizhiyong_11 发表于 2017-7-29 12:47:33

我要看答案

lllier 发表于 2017-8-1 20:19:39

草稿本上

a1294951692 发表于 2017-8-2 13:02:57

guojing776 发表于 2017-8-2 15:40:26

22

沐木月 发表于 2017-8-2 21:22:14

{:5_91:}

zxc26886616 发表于 2017-8-3 22:02:29

{:5_91:}

WLL 发表于 2017-8-11 12:43:55

测试题

helloword李 发表于 2017-8-14 19:08:27

2

笨小孩KK 发表于 2017-8-15 16:57:28

{:5_93:}

benjuded 发表于 2017-8-16 23:01:46

答案

xife丶 发表于 2017-8-16 23:08:41

{:10_277:}

轩续 发表于 2017-8-18 13:51:39

1
页: 1 2 3 4 5 6 7 8 9 10 [11] 12 13 14 15 16 17 18 19 20
查看完整版本: S1E16:拾遗 | 课后测试题及答案