摘要: 用switch结构#include<stdio.h>int main(){ char x; scanf("%c",&x); switch(x) { case 'A':printf("85~100\n"); case 'B':printf("70~84\n"); case 'C':printf("60~69\n"); case 'D':printf("<60\n"); default :printf(&quo 阅读全文
posted @ 2012-05-19 10:26 尔滨之夏 阅读(215) 评论(0) 推荐(0) 编辑
摘要: #include<stdio.h>#include<math.h>#define PI 3.1415927int main(){ double a,v; while(scanf("%lf",&a)!=EOF) { v=(4.0/3.0)*PI*a*a*a; printf("%.3f\n",v); } return 0;} 阅读全文
posted @ 2012-05-19 10:00 尔滨之夏 阅读(307) 评论(0) 推荐(0) 编辑
摘要: #include<stdio.h>#include<math.h>int main(){ float x1,x2,y1,y2; float m; while(scanf("%f%f%f%f",&x1,&x2,&y1,&y2)!=EOF) { m=sqrt((float)((x1-y1)*(x1-y1)+(x2-y2)*(x2-y2))); printf("%.2f\n",m); } return 0;} 阅读全文
posted @ 2012-05-19 09:58 尔滨之夏 阅读(123) 评论(0) 推荐(0) 编辑
摘要: getchar()是应为换行,还有指针#include<stdio.h>#include<string.h>int main(){ void swap(char*q1,char*q2); char a,b,c; char *p1,*p2,*p3; while(scanf("%c%c%c",&a,&b,&c)!=EOF) { getchar(); p1=&a; p2=&b; p3=&c; if(*p1>*p2)swap(p1,p2); if(*p1>*p3)swap(p1,p3); ... 阅读全文
posted @ 2012-05-19 09:54 尔滨之夏 阅读(840) 评论(0) 推荐(0) 编辑