码迷,mamicode.com
首页 > 其他好文 > 详细

第二次实验

时间:2019-04-22 16:38:12      阅读:126      评论:0      收藏:0      [点我收藏+]

标签:mat   http   input   inf   image   char   scan   png   argc   

#include "stdafx.h"

 

int main(int argc, char* argv[])

{

         char a,b,c,d,e;

         a=getchar();

         b=getchar();

         c=getchar();

         d=getchar();

         e=getchar();

         putchar(a);

         putchar(b);

         putchar(c);

         putchar(d);

         putchar(e);

         return 0;

}技术图片

#include "stdafx.h"

 

int main(int argc, char* argv[])

{

         int year;

         printf("input the year.");

         scanf("%d",&year);

         if (year%4!=0){

                   printf("year:%d,month:2,days:28",year);}

         else if(year%100!=0){

                   printf("year:%d,month:2,days:29",year);}

         else if(year%400!=0){

                   printf("year:%d,month:2,days:28",year);}

         return 0; 

}技术图片

 

#include "stdafx.h"

#include<stdio.h>

int main(int argc, char* argv[])

{

    int a,b,c;

    scanf("%d %d %d",&a,&b,&c);

                   if(a+b<=c||a+c<=b||b+c<=a)

                   {

                            printf("无法构成三角形");

                   }

                   else if(a*a+b*b==c*c||a*a+c*c==b*b||b*b+c*c==a*a)

                   {

                            printf("直角三角形");

                   }

                   else if ((a==b&&b!=c)||(a==c&&b!=c)||(b==c&&c!=a))

                   {

                            printf("等腰三角形");

                   }

                            else if (a==b&&b==c)

                            {

                                     printf("等边三角形");

                            }

                            else {

                                     printf("一般三角形");

        }

                   return 0;

}

技术图片技术图片

#include "stdafx.h"

#include "math.h"

int main(int argc, char* argv[])

{

         int a;

         double rate,tax,profit;

         printf("请输入奖金数:");

         scanf("%d",&a);

         if(a<500){

                   rate=0.00;}

         else if(a>=500 && a<1000){

                   rate=0.05;}

         else if(a>=1000 && a<2000){

                   rate=0.08;}

         else if(a>=2000 && a<5000){

                   rate=0.10;}

         else{

                   rate=0.15;}

         tax=a*rate;

         profit=a-tax;

         printf("rate=%.2lf,tax=%.2lf,profit=%.2lf",rate,tax,profit);

}

}技术图片技术图片技术图片

第二次实验

标签:mat   http   input   inf   image   char   scan   png   argc   

原文地址:https://www.cnblogs.com/p201821440001/p/10749835.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!