160809225-叶桦汀《C语言程序设计》实验报告

#include<stdio.h>
int main()
{
    int a,b,c,t;
    printf("请输入三个整数");
    scanf("%d%d%d",&a,&b,&c);
    if(a<b){
        t=a;
        a=b;
        b=t;
        }
  if(b>c)  {
      
  printf("%d\t%d\t%d\n",a,b,c);}
  else if(c<a){
      printf("%d\t%d\t%d\n",c,a,b); }
  else{
      printf("%d\t%d\t%d\n",a,b,c);
  }
  return 0;
  }

# include <stdio.h> 
# include <math.h> 
int main(void)
{
   double x, y; 
   printf("输入 x:");
   scanf("%lf", &x); 
   if (x >4){
       y = sqrt(x-4);
   }
   else if (x <-5){
       y =fabs(x);
   }
   else{
      y = x+3;
   }
   printf("结果= %.2f\n",  y);
return 0;
}

#include<stdio.h>
int main()
{
   char ch;
   printf("请输入一个字符:\n");
   scanf("%c",&ch);
   printf("其大写字符是:%c\n",ch-32);
}

# include <math.h> 
int main(void)
{
   double x, y; 
   printf("输入 x:");
   scanf("%lf", &x); 
   if (x >=10){
       y = (3*x)-11;
   }
   else if (x <1){
       y =x;
   }
   else {
      y = (2*x)-11;
   }
   printf("结果= %.2f\n",  y);
return 0;
}

# include <stdio.h> 
int main(){
    int a;
    printf("请输入成绩;");
    while(scanf("%d",&a)   &&  a >= 0  &&  a <= 100)
    if(a>=90)
        {printf("A");}
    else if(a<=89&a>=80){
        printf("B");}
    else if(a<=79&a>=70)
        {printf("C");}
    else if(a<=69&a>=60){
    printf("D");
        }
    else if(a<60){
    printf("E");
        }
}

这次作业花了我很多时间在这期间我翻阅了课件,课本,还有上网查这体现出了我对这个还不熟练还有就是小毛病很多。这一点是很达到问题在以后编一个程序时会有几十万个代码其中的小错误出错了找起来就会非常麻。烦也可能会影响整个程序的运行。所以培养认真编程是非常重要的。还有就是片头问题我一直认为片头只有一个而在做第四题时我只用了一个mathH。可一直得不出答案,我就查了去网上查了一下其他人在做函数是的代码才认识到我的错误所在,查询资料和借鉴他人的经验也是十分必要的 。

  

 

posted on 2016-09-24 21:35  叶桦汀  阅读(192)  评论(1编辑  收藏  举报

导航