1、#include main() float pi=3.14159265,r; printf(enter radius:n); scanf(%f,&r); printf(r=%.2f,c=%.2f,area=%.2fn,r,2*pi*r,pi*r*r); system(pause); #include main() int m,n,x,y; printf(inputm,n:n); scanf(%d%d,&m,&n); if (n%2=1) printf(error! n bu shi ji shu!n,n); return; /*n在这里不能是奇数*/ x=(4*m-n)/2; y=(n-2*m
2、)/2; if(x=0)&(y=0) printf(x=%d,y=%dn,x,y); else printf(shu ru cuo wu!n); getch(); #include #include #include main() float a,b,C; printf(enter 3number(a,b,C):n); scanf(%.2f %.2f %.2f,&a,&b,&C); s=0.5*a*b*sinC; printf(s=%.2fn,s); system(pause); #include main() int ds,nl,yf; char c; printf(shu ru ds;n)
3、; scanf(%d,&ds); if (ds1184) printf(input error!press any end.n); scanf(%c,&c); exit(0); /*输入的数字必须是-141184之间*/ nl=(ds+115)%100; yf=(ds+115)/100; printf(nl=%d,yf=%dn,nl,yf); system(pause); #include #include main() char s1100,s2100,s3100,s4100; printf(input a string:n); gets(s1); strcpy(s1,s2); strcat
4、(s1,-); strcpy(s3,strcat(s1,-); strcat(strcpy(s3,strcat(s1,-),s2); strcpy(s4,strcat(strcpy(s3,strcat(s1,-),s2); puts(s4); system(pasue); getch(); #include #include main() float x1,x2,a,b,c; printf(input 3 number(a,b,c):n); scanf(%f%f%f,&a,&b,&c); x1=(-b+sqrt(b*b-4*a*c)/(2*a); x2=(-b-sqrt(b*b-4*a*c)/
5、(2*a); printf(x1=%f,X2=%fn,x1,x2); system(pause); getch(); #include main() int a,b,c,t; printf(input 3 number:n); scanf(%d%d%d,&a,&b,&c); if(ab) t=a;a=b,b=t; if(ac) t=a;a=c;c=t; if(bc) t=b;b=c;c=t; printf(1:%d,2:%d,3:%dn,a,b,c); system(pause); #include #include #include main() float pi=3.14159265,r;
6、 textbackground(YELLOW);/* 设置背景色为黄色,注意颜色应该大写,可更改 */ textcolor(RED); /* 设置文件颜色为红色,可更改 */ clrscr(); /* 清屏,使设置生效 */ printf(enter radius:); scanf(%f,&r); if(r0) printf(Enter Error!n); else printf(r=%.2f,c=%.2f,area=%.2fn,r,2*pi*r,pi*r*r); system(pause);/* 暂停,按任一键继续 */ #include #include #include main() f
7、loat a,b,c,delt,x1,x2,p,q; textcolor(YELLOW); clrscr(); printf(Input a b c:n); scanf(%f%f%f,&a,&b,&c); if(a=0) printf(Its not a quadratic equation!n); system(pause); return; delt=b*b-4*a*c; if(delt=0) x1=(-b+sqrt(delt)/(2*a); x2=(-b-sqrt(delt)/(2*a); printf(x1=%.3f x2=%.4fn,x1,x2); else p=-b/(2*a);q
8、=sqrt(-delt)/(2*a); printf(p=%.4fq=%.4fn,p,q); system(pause); getch(); #include main() float pi=3.14159265,r; int k=0; while(k=3) printf(enter radius:n); scanf(%f,&r); printf(r=%.2f,c=%.2f,area=%.2fn,r,2*pi*r,pi*r*r); printf(press any key to continuenpress esc to exit.); k+; #include #include #inclu
9、de #include main() int a,b,c,oper; long limit,i=0; char char1; textcolor(GREEN);/*设置字体颜色为绿色*/ clrscr(); /*清屏,是设置生效*/ while(i=3) printf(qing xuan ze jia huo jian(1or2,1:+,2:-n); scanf(%d,&oper); printf(Enter max (10000):n); scanf(%ld,&limit); srand(unsigned long)time(0); a=rand()*limit/RAND_MAX; b=ra
10、nd()*limit/RAND_MAX; while(ab)&(oper=2) a=rand()*limit/RAND_MAX; b=rand()*limit/RAND_MAX; char1=(oper=2?-:+); printf(%d%c%dn,a,char1,b); scanf(%d,&c); if(oper=2&a-b=c)|(oper!=2&a+b=c) printf(OK!You are very clever!n); else printf(The result is not correct!n); i+; getch(); #include #include main() in
11、t y,i=0; textcolor(YELLOW); /*天下事无难易之分只有做与不做之别*/ textbackground(GREEN); clrscr();/*清屏,是设置生效*/ while(i=3) printf(Input year:n); scanf(%d,&y); if(y%4=0) if(y%100=0) if(y%400=0) printf(y shi run nian!n); else printf(y bu shi run nian !n); else printf(y shi run nian!n); else printf(y bu shi run nian!);
12、i+; getche(); #include#include#includemain()int xz,wday1,hour1;struct tm *timeptr;time_t secsnow;char s130,s230,s330;printf(input whom do you say to?:n);scanf(%d,&xz);if(xz=1)strcpy(s1,mother);else if(xz=2)strcpy(s1,father);elsestrcpy(s1,);time(&secsnow);timeptr=localtime(&secsnow);wday1=timeptr-tm_
13、wday;if(wday1=6)strcpy(s2,Happy saturday!);else if(wday1=0)strcpy(s2,Happy sunday);elsestrcpy(s2,);hour1=timeptr-tm_hour;if(hour1=4&hour1=17&hour1=22)strcpy(s3,Good afternoon!);elsestrcpy(s3,Good evening!);printf(%s%s%s,s1,s2,s3);getch();#include#includemain()int day,year,month,i=0;textbackground(BR
14、OWN);clrscr();while(i=3)printf(Input 2 number:n);scanf(%d%d,&year,&month);switch(month)case 1:case 3:case 5:case 7:case 8:case 10:case 12: day=31;break;case 4:case 6:case 11:day=30;break;case 2:day=28;if(year%4=0&year%100!=0)|year%400=0)day=29;break;deflault:printf(Invalid month input!n);return;printf(There are%d days in %d.%dn,day,year,month);i+;getch();
copyright@ 2008-2023 冰点文库 网站版权所有
经营许可证编号:鄂ICP备19020893号-2