内容发布更新时间 : 2024/12/22 19:00:27星期一 下面是文章的全部内容请认真阅读。
1-5 #include
{ printf (\ printf(\ Very Good!\\n\\n\
printf (\ return 0; }
1-6#include
printf(\ scanf(\ max=a; if (max
printf(\ return 0; } 4-4-1
#include
int a,b,c;
printf(\请输入三个整数:\ scanf(\ if (a
printf(\ else
printf(\ else if (a printf(\ else printf(\ return 0; } 4-6. #include printf(\输入x:\ scanf(\ if(x<1) /* x<1 */ { y=x; printf(\ y=x=%d\\n\ } else if(x<10) /* 1= 4-7-1 #include int x,y; printf(\ scanf(\ y=-1; if(x!=0) if(x>0) y=1; else y=0; printf(\ return 0; } 4-7-2 #include int x,y; printf(\ scanf(\ y=0; if(x>=0) if(x>0) y=1; else y=-1; printf(\ return 0; } 4-8 #include { float score; char grade; printf(\请输入学生成绩:\ scanf(\ while (score>100||score<0) {printf(\输入有误,请重输\ scanf(\ } switch((int)(score/10)) {case 10: case 9: grade='A';break; case 8: grade='B';break; case 7: grade='C';break; case 6: grade='D';break; case 5: case 4: case 3: case 2: case 1: case 0: grade='E'; } printf(\成绩是 %5.1f,相应的等级是%c\\n \ return 0; } 4-11 #include {int t,a,b,c,d; printf(\请输入四个数:\ scanf(\ printf(\ if (a>b) { t=a;a=b;b=t;} if (a>c) { t=a;a=c;c=t;} if (a>d) { t=a;a=d;d=t;} if (b>c) { t=b;b=c;c=t;} if (b>d) { t=b;b=d;d=t;} if (c>d) { t=c;c=d;d=t;} printf(\排序结果如下: \\n\ printf(\ %d %d %d \\n\ ,a,b,c,d); return 0; } 4-12 #include int h=10; float x1=2,y1=2,x2=-2,y2=2,x3=-2,y3=-2,x4=2,y4=-2,x,y,d1,d2,d3,d4; printf(\请输入一个点(x,y):\ scanf(\ d1=(x-x4)*(x-x4)+(y-y4)*(y-y4); /*求该点到各中心点距离*/ d2=(x-x1)*(x-x1)+(y-y1)*(y-y1); d3=(x-x2)*(x-x2)+(y-y2)*(y-y2); d4=(x-x3)*(x-x3)+(y-y3)*(y-y3); if (d1>1 && d2>1 && d3>1 && d4>1) h=0; /*判断该点是否在塔外*/ printf(\该点高度为 %d\\n\ return 0; } 5-3 #include int p,r,n,m,temp; printf(\请输入两个正整数n,m:\ scanf(\ if (n temp=n; n=m; m=temp; } p=n*m; while(m!=0) { r=n%m; n=m;