auau3690 发表于 2017-11-15 21:15:03

Look at!

Lindaminmindear 发表于 2017-11-15 22:54:15

1

qq1724642151 发表于 2017-11-16 19:37:05

,,,,,,

brank 发表于 2017-11-16 20:53:45

打卡!

易天 发表于 2017-11-16 21:11:59

看看

活力无极限1944 发表于 2017-11-18 20:25:14

本帖最后由 活力无极限1944 于 2017-11-18 20:30 编辑

0,10个
1,0个
2,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;
}
bill = cost * flag;
B
if (ibex > 14)
{
    sheds = 3;
}
else
{
        sheds = 2;
}
help = 2 * sheds;
C
scanf("%d", &score);
while (score >= 0)
{
      count++;
      scanf("%d", &score);
}
printf("count = %d\n", count);
0,
#include <stdio.h>
#include <math.h>

int main()
{
                float i, j;
                int n;
               
                for (n = 1; ;n++)
                {
                                i = 10000 * 0.1 * n + 10000;
                                j = 10000 * pow(1 + 0.05 , n);
                               
                                if (j > i)
                                {
                                                break;
                                }
                }
               
                printf("%d年后,黑夜的投资额超过小甲鱼!\n", n);
                printf("小甲鱼的投资额是:%.2f\n", i);
                printf("黑夜的投资额是:%.2f\n", j);
               
                return 0;
}
1,
#include <stdio.h>

int main()
{
                int n;
                float i;
               
                for (n = 2, i = 350; ;n++)
                {
                                i = i * (1 + 0.08) - 50;
                               
                                if (i <= 0)
                                {
                                                break;
                                }
                }
               
                printf("%d年之后,小甲鱼败光了所有的家产,再次回到一贫如洗……\n", n);
               
                return 0;
}

secrect 发表于 2017-11-19 03:36:14

1111

fang5888 发表于 2017-11-19 19:43:37

huifu

徐磊啊 发表于 2017-11-19 22:59:56

学习

批亢捣虚 发表于 2017-11-24 21:42:18

0. 100
1. 0
2. 5
3. a = 14; b = 5; c = 9
4. #include<stdio.h>

int main()
{
        int i,z;
       
        printf("请输入i的值:");
        scanf("%d", &i);
       
        if (i < 0)
        {
                z = -i;
        }
        else (z = i);
        printf("%d", z);
       
        return 0;
}
5.A: if (size > 12)
{
        cost = cost * 12;
        flag = 2;
}
else
{
        bill = cost * flag;
}
B: if (ibex > 14)
{
        sheds = 3;
}
sheds = 2;
help = 2 * sheds;


0.

yaojiawang2016 发表于 2017-11-25 15:32:20

1

Vision 发表于 2017-11-27 14:24:07

本帖最后由 Vision 于 2017-11-27 14:33 编辑

动动手:

0.

#include <stdio.h>

int main()
{
        int i=0;
        double dl=0,fl=1,xjy=10000,hy=10000;
       
        while(hy<=xjy)
        {
                dl=dl+10000.0*10/100;
                xjy=10000+dl;
                fl=fl*(1+0.05);
                hy=10000*fl;
                i++;
        }

        printf("%d年后,黑夜的投资额超过小甲鱼!\n",i);
        printf("小甲鱼的投资额是:%.2lf\n",xjy);
        printf("黑夜的投资额是:%.2lf\n",hy);
       
        return 0;
}

--------------------------------------------

1.

#include <stdio.h>

int main()
{
        double benjin=4000000;
        int i=0;

        while(benjin>=0)
        {
                benjin=(benjin-500000)*(1+0.08);
                i++;
        }

        printf("%d年后,小甲鱼败光了所有的家产,再次回到一贫如洗...\n",i);

        return 0;
}

----------------------------------------------------------------

2.

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

int main()
{
        double pi=0;
       
        {
                int i=1,f=1;
                double dx=1;
               
                while(fabs(dx)>1e-8)
                {
                        pi=pi+dx;
                        i=i+2;
                        f=-f;
                        dx=f*(double)1/i;
                }
        }
        pi=pi*4;
        printf("π ≈ %.7lf\n",pi);

        return 0;
}

----------------------------------------------------------------

3.

#include <stdio.h>

int main()
{
        int f1=1,f2=1,s,i;

        for(i=3;i<=24;i++)
        {
                s=f1+f2;
                f1=f2;
                f2=s;
        }

        printf("两年后可以繁殖%d对兔子。\n",f2);

        return 0;
}

风过无痕丶 发表于 2017-11-28 12:51:51

课后测试题及答案

太别致旳温柔 发表于 2017-11-28 14:40:20

0.10个
1.0个
2.a, b, c
3.a=3, 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;
}
else
{
        sheds = 2;
        help = 2 * sheds;
}
C.
while (score >= 0)
{
        count++;
        scanf("%d", &score);
}
        printf("count = %d\n", count);

太别致旳温柔 发表于 2017-11-28 14:47:36

#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main()
{
    float XiaoJiaYu, HeiYe;
    float SingleInterest, CompoundInterest;
    int countYear = 1;

    SingleInterest = 0.1;
    CompoundInterest = 0.05;
    XiaoJiaYu = 10000 * (1 + SingleInterest);
    HeiYe = 10000 *(1 + CompoundInterest);
    while (XiaoJiaYu > HeiYe)
    {
      countYear++;
      XiaoJiaYu += 10000 * SingleInterest;
      HeiYe *= (1 + CompoundInterest);
    }
    printf("%d年后,黑夜的投资超过小甲鱼!\n", countYear);
    printf("小甲鱼的投资额是:%.2f\n", XiaoJiaYu);
    printf("黑夜的投资额是:%.2f\n", HeiYe);


    float XiaoJiaYu;
    int Year = 1;

    XiaoJiaYu = 3500000;
    while (XiaoJiaYu > 0)
    {
      Year++;
      XiaoJiaYu *= (1 + 0.08);
      XiaoJiaYu -= 500000;
    }
    printf("%d年之后,小甲鱼败光了所有的家产,再次回到一贫如洗......", Year);

    double i = 1.0, Denominator = 1.0;
    double temp, sum = 1.0;

    do
    {
      i = -i;
      Denominator += 2;
      temp = i / Denominator;
      if (fabs(temp) > 0.00000001)
      {
            sum += temp;
      }
      else
      {
            break;
      }
    } while (1);

    sum *= 4.0;

    printf("PI的近似值是:%.7f", sum);


    int f1, f2, f3, sum;

    f1 = f2 = 1;
    sum = f1 + f2;
    for (int i = 3; i <= 24; i++)
    {

      f3 =f1 + f2;
      sum += f3;
      f1 = f2;
      f2 = f3;
    }
    printf("两年后总共繁殖了%d对兔子!\n", sum);
      return 0;
}

Zeon. 发表于 2017-11-28 20:00:38

1

great坏小孩 发表于 2017-11-28 20:22:18

核对答案

浅安丶 发表于 2017-11-29 14:21:52

0.10个
1.打印0个B。因为i=0;不执行循环。
2.cba
3.++c+++b左值错误。
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;
}
sheds = 2;
help = 2 * sheds;

C:
if (score < 0)
{
      gprintf("count = %d\n", count);
}
count++;
scanf("%d", &score);
动手0.
#include<stdio.h>

int main()
{
    float a,b,y;
    a=10000*0.1+10000;
    b=10000*0.05+10000;
    for(y=1;b<a;y++)
    {
      a+=1000;
      b*=1.05;
    }
    printf("%0.0f年后,黑夜的投资额超过小甲鱼!\n",y);
    printf("小甲鱼的投资额是:%0.2f\n",a);
    printf("黑夜的投资额是:%0.2f",b);
    return 0;
}
1.
#include<stdio.h>

int main()
{
    float a,y;
    a=3500000;
    for(y=1;a>0;y++)
    {
      a=a*1.08-500000;
    }
    printf("%0.0f年后,小甲鱼一贫如洗!\n",y);
    return 0;
}
3.写的看起来有点蠢虽然结果是对了..

zjhnz 发表于 2017-11-29 22:54:34

xuexi

青春有悔! 发表于 2017-12-3 09:54:24

对答案啊
页: 5 6 7 8 9 10 11 12 13 14 [15] 16 17 18 19 20 21 22 23 24
查看完整版本: S1E16:拾遗 | 课后测试题及答案