牧影人 发表于 2020-12-11 23:32:27

1

暮色丶月夜 发表于 2020-12-12 00:25:17

q

qq2760958935 发表于 2020-12-12 12:54:15

2333

嘴角微微上扬 发表于 2020-12-13 09:14:11

查看参考答案

Superhomme 发表于 2020-12-13 15:16:59

对答案

5566778899 发表于 2020-12-13 17:28:25

0 ;100
1;0 (i++是先判断再增加 ++i是先加1再判断)
2;c = 5; b = c;a = b;
3;b=5 c= 5
4;if (x>=0) z = x;
   else z = -x;
5A;if (size > 12)
{ cost cost*1.05;flag = 2;}else{bill = cost*flag;}

B;
if sheds = 3;else shed =2 ; help = 2* sheds;

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

育人三代 发表于 2020-12-14 17:10:05

朕想知道

pop智慧树 发表于 2020-12-14 19:42:26

十分感谢

happydogzjk 发表于 2020-12-14 22:11:59

0:int main()
{
      int i=10000,year=0;
      double rate1=0.1,rate2=0.05;
      double result1=0,result2=1;
      while(++year)
      {
              result1=i+i*rate1*year;
              result2=result2*(1+rate2);
      //        printf("year=%d,result1=%.2f,result2=%.2f\n",year,result1,i*result2);
              if (i*result2>result1)
              {
                      //printf("year=%d,result1=%.2f,result2=%.2f\n",year,result1,i*result2);
                                break;
                        }
      
                }
      printf("%d年后,黑夜的投资超过小甲鱼!\n");
      printf("小甲鱼的投资额是:%.2f\n",result1);
      printf("黑夜的投资额是:%.2f",result2*i);
      

      

      return 0;
}

zaphkiel 发表于 2020-12-15 13:19:48

太难了

猫和狼 发表于 2020-12-15 13:32:12

回复

Kasileo 发表于 2020-12-15 15:07:52

11111111111

李古拉斯百奇 发表于 2020-12-15 16:06:29

#include <stdio.h>

int main()
{
        int x;
        int z;
       
        printf("请输入一个整数:");
        scanf("%d",&x);
        z = x >= 0 ?x : -x;
       
        printf("绝对值是%d",z);
}

ChokerQ 发表于 2020-12-16 13:45:13

一时之快

皓皓原来不太俊 发表于 2020-12-17 04:00:33

=。=

1296657603a 发表于 2020-12-17 14:27:56

【】平平平平平平平平

努力学c的小汪 发表于 2020-12-17 22:44:24

1

Aruuuu 发表于 2020-12-18 12:40:15

小测试:
0. 10个‘A'
1.10
2. a
3. a=15   b=5c=10
4. x>=0 ? z=x : z=-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)
{
      printf("count = %d\n", count);
}
count++;
scanf("%d", &score);
动动手:
0.
#include <stdio.h>
#define INI 10000

int main()
{
      float f=INI,d=INI;
      int count=0;

      do
      {
                f += INI * 0.1;
                d += d * 0.05;
                count = count + 1;
      }
      while ( f >= d );

      printf("%d年后,黑夜的投资额超过了小甲鱼!\n",count);
      printf("小甲鱼的投资额是:%.2f\n",f);
      printf("黑夜的投资额是:%.2f\n",d);

      return 0;
}


1.
#include <stdio.h>

int main()
{
      int year=0;
      float m=400;

      do
      {
                year += 1;
                m -= 50;
                m *= 1.08;
      } while ( m>0 );

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

      return 0;
}


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


int main()
{
      double result=0,i;
      int n;
      _Bool f=1;

      for ( n = 1; n < pow(10,8); n +=2 )
      {
                i = 1.0 / n;
                switch (f)
                {
                        case 1: f = 0; break;
                        case 0: i = -i; f = 1; break;
                }

                result += i;
      }

      printf("pi = %.7f\n",result*4);

      return 0;
}


3.
#include <stdio.h>

int main()
{
      int m,b1=1,b2=0,b3,sum=0;
      sum = b1 + b2;
      for ( m = 3; m <= 24; m++ )
      {

                b3 = b1 + b2;
                sum = sum + b3;
                b2 = b3;
                b1 = b2;
      }

      printf("两年后,共有%d只兔子\n",sum);

      return 0;
}




GGQ233 发表于 2020-12-19 13:28:16

1

瞪太阳 发表于 2020-12-19 13:52:38

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

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

C.
scanf("%d", &score);
if (score < 0)
{
      printf("count = %d\n", count);
}
else
{
count++;
scanf("%d", &score);
printf("count = %d\n", count);
}
页: 132 133 134 135 136 137 138 139 140 141 [142] 143 144 145 146 147 148 149 150 151
查看完整版本: S1E16:拾遗 | 课后测试题及答案