标签:ase bre img .com tput argc getchar etc tchar
1.
#include "stdafx.h"
#include <stdio.h>
int main(int argc, char* argv[])
{
char a,b,c,d;
a = getchar();
b = getchar();
c = getchar();
d = getchar();
putchar(a);
putchar(b);
putchar(c);
putchar(d);
putchar(‘\n‘);
return 0;
}
2.
#include "stdafx.h"
#include <stdio.h>
int year,days;
printf("intput year:");
scanf("%d",&year);
if((year % 100 != 0 && year % 4 == 0 )|| year % 400 == 0)
{
printf("year:%d,month:2,das:29",year);
}
else
{
printf("year:%d,month:2,das:28",year);
}
return 0;
}
3.
#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)
{
if(a*a+b*b==c*c || a*a+c*c==b*b || b*b+c*c==a*a)
{ printf("所给三条边能构成直角三角形\n"); }
else if(a==b && b==c) { printf("所给三条边能构成等边三角形\n"); }
else if(a==b && b!=c || a==c && c!=b || b==c && c!=a) { printf("所给三条边能构成等腰三角形\n"); }
else { printf("所给三条边能构成一般三角形\n"); }
}
else
{
printf("所给三条边不能构成三角形\n");
}
return 0; }
4.
#include "stdafx.h"
#include <stdio.h>
int main(int argc, char* argv[])
{
double a,rate,tax,profit;
scanf("%lf",&a);
if(a<500){rate=0.00;}
else if(a<1000){rate=0.05;}
else if(a<2000){rate=0.08;}
else if(a<5000){rate=0.10;}
else {rate=0.15;}
tax=a*rate;
profit=a-tax;
printf("a=%lf\trate=%lf\ttax=%lf\tprofit=%lf\n",a,rate,tax,profit);
return 0;
}
#include "stdafx.h"
#include <stdio.h>
int main(int argc, char* argv[])
{
int b;
double a,rate,tax,profit;
scanf("%lf",&a);
b=(int)a/500;
switch(b)
{
case 0 :rate = 0;break;
case 1 :rate = 0.05;break;
case 2 :rate = 0.08;break;
case 3 :rate = 0.08;break;
case 4 :rate = 0.10;break;
case 5 :rate = 0.10;break;
case 6 :rate = 0.10;break;
case 7 :rate = 0.10;break;
case 8 :rate = 0.10;break;
case 9 :rate = 0.10;break;
default :rate = 0.15;break;
}
tax=a*rate;
profit=a-tax;
printf("a=%lf\trate=%lf\ttax=%lf\tprofit=%lf\n",a,rate,tax,profit);
return 0;
}
标签:ase bre img .com tput argc getchar etc tchar
原文地址:https://www.cnblogs.com/p201821430018/p/10768873.html