第四周做業

一,做業代碼html

7-1.代碼以下git

#include<stdio.h>
int main()
{
  float x,y;
  scanf("%f",&x);
  if(x!=0)
  {
      y=1/x;
      printf("f(%.1f) = %.1f",x,y);
  }
  else
  {
      printf("f(0.0) = 0.0");
  }
  return 0;
}

設計思路sass

1.設出x,y學習

2.根據題目設出if語句spa

3.輸出結果.net

流程圖:設計

提交截圖code

由於沒有注意到輸出格式因此出現了一些問題htm

通過認真審題及時發現錯誤並改正blog

7-2 代碼以下:

#include<stdio.h>
int main()
{
  float x,y,z;
  scanf("%f %f",&x,&y);
  if(y!=0)
  {
    if(y>0)
    {
        z=x/y;
        printf("%.0f/%.0f=%.2f",x,y,z);    
    }
    else
    {
        z=x/y;
        printf("%.0f/(%.0f)=%.2f",x,y,z);    
    }    
  }
  else
  {
      printf("%.0f/%.0f=Error",x,y);
  }
  return 0;
}

設計思路:

1.設出x,y,z

2.根據題目給出x,y範圍

3.根據題目設出if語句

4.輸出結果

流程圖:

提交截圖

輸入條件不正確致使部分正確  經仔細審題改正錯誤

7-6代碼以下

#include<stdio.h>
int main()
{
  float x,y;
  scanf("%f",&x);
  if(x<0)
  {
      printf("Invalid Value!");
  }
  else if(50<x)
  {
      y=0.58*(x-50)+26.5;
      printf("cost = %.2f",y);
  }
  else
  {
      y=0.53*x;
      printf("cost = %.2f",y);
  }
  return 0;
}

設計思路:

1.設出x,y,

2.根據題目設出if語句

3.輸出結果

流程圖:

提交截圖

7-7代碼以下

#include<stdio.h>
int main()
{
    float a,c,d;
    int b;
    scanf("%f %d",&a,&b);
    if(a<=3)
    {
        c=10;
    }
    else if(a<=10)
    {
        c=10+(a-3)*2;
    }
    else
    {
        c=24+(a-10)*3;
    }
    

 

;
    printf("%d",(int)d);
    return 0;
}

 設計思路:

1.設出a,b,c,d

2.根據題目設出if語句

3.輸出結果

流程圖:

提交截圖

 

二,提交至git 

上傳git截圖:

git地址:

https://coding.net/u/AssassinCreed/p/Devil-May-Cry/git

三,本週學習狀況

1.本週內容總結:

本週內學習了很是重要的if語句並經過pta做業熟練掌握

2.評論其餘同窗:

胡景文:

http://www.cnblogs.com/wshjw/p/7748614.html

班慶澤:

http://www.cnblogs.com/wsbqz/p/7748669.html

顧家偉:

http://www.cnblogs.com/qq807443119/p/7748520.html<>

3.學習進度條:

時間

代碼

時間

博客字數

博客時間

10.21

120

40

0

0

10.22

130

40

0

0

10.23

200

60

0

0

10.24

180

50

0

0

10.25

90

30

0

0

10.26

120

40

0

0

10.27

120

40

0

0

10.28

30

10

200

180

相關文章
相關標籤/搜索