1350539689 发表于 2019-7-19 19:36:35

感谢分享

zzf0817 发表于 2019-7-20 14:39:43

{:10_277:}

fishc098 发表于 2019-7-20 16:36:00

小甲鱼

DT_Nelson 发表于 2019-7-20 19:25:55

#include <stdio.h>

int main(){
        int count = 0;
        double a, b;
        a = b = 10000;

        do{
                a += 0.1*10000;
                b *= 1.05;
                count++;
        }while(a>=b);
       
        printf("After %d years,heiye will have more money than xiaojiayu.\n", count);
        printf("xiaojiayu's money: %.2lf\n", a);
        printf("heiye's money: %.2lf\n", b);

        return 0;
}

DT_Nelson 发表于 2019-7-20 19:33:13

#include <stdio.h>

int main(){
        int count = 0;
        float money = 400;

        do{
                money -= 50;
                money *= 1.08;
                count++;
        }while(money>0);

        printf("After %d years,xiaojiayu becomes poor again!\n", count);

        return 0;
}

DT_Nelson 发表于 2019-7-20 19:48:39

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

int main(){
        double pi = 0, temp, i = 1.0;

        do{
                temp = (int)i%4==1?1/i:-1/i;
                pi += temp;
                i += 2;
        }while(fabs(temp)>=pow(10, -8));

        pi *= 4;
        printf("%.7lf\n", pi);
        return 0;
}

DT_Nelson 发表于 2019-7-20 19:55:23

#include <stdio.h>

int main(){
        int a;
        a = a = 1;

        for(int i = 2; i<24; i++){
                a = a + a;
        }

        printf("After 2 years,there'll be %d pairs of rabbits.\n", a);
        return 0;
}

wyhgogogo 发表于 2019-7-21 08:38:05

1

lllhc11 发表于 2019-7-21 10:58:38

打卡打卡

lllhc11 发表于 2019-7-21 11:07:19

小甲鱼goto语句那里是不是搞错了呀,goto语句不是跳转到标签后就从标签开始顺序执行吗

#include <stdio.h>

int main(void)
{
        int size;
        int cost = 1, flag = 1, bill = 1;

        scanf("%d", &size);
        if (size > 12)
        {
              goto a;
                       printf("OOKK!\n");
        }

        printf("here!\n");
        goto b;
a:cost = cost * 1.05;
    flag = 2;
b:bill = cost * flag;
}

lllhc11 发表于 2019-7-21 11:08:05

lllhc11 发表于 2019-7-21 11:07
小甲鱼goto语句那里是不是搞错了呀,goto语句不是跳转到标签后就从标签开始顺序执行吗

#include


我输入13的话,他是什么都不打印欸

bro丶 发表于 2019-7-21 14:57:10

看看

jiajie8808 发表于 2019-7-22 10:49:03

加油

潇洒小小鸟 发表于 2019-7-22 11:05:49

1

q641565962 发表于 2019-7-22 14:28:51

看看

矮子-小甲鱼 发表于 2019-7-22 16:52:15

a

LIVESTRONG 发表于 2019-7-22 19:21:07

作者吱吱吱吱吱吱吱吱

快乐裤衩 发表于 2019-7-22 19:37:40

lgpmynpy

zhi.wang 发表于 2019-7-22 19:51:49

实测为

15518870632 发表于 2019-7-22 20:28:12

{:5_90:}
页: 43 44 45 46 47 48 49 50 51 52 [53] 54 55 56 57 58 59 60 61 62
查看完整版本: S1E16:拾遗 | 课后测试题及答案