上一页 1 ··· 5 6 7 8 9
摘要: 运用do,while语句输出#include<stdio.h>int main(){ int a,b,c,d; while(scanf("%d",&a)!=EOF) { do{ b=a%10; a=a/10; printf("%d",b); }while(a!=0); printf("\n"); } return 0;} 阅读全文
posted @ 2012-05-22 20:38 尔滨之夏 阅读(223) 评论(0) 推荐(0) 编辑
摘要: 运用do,while语句,逐个输出。#include<stdio.h>int main(){ int a,b,c,d; while(scanf("%d",&a)!=EOF) { do{ b=a%10; a=a/10; printf("%d\n",b); }while(a!=0); } return 0;} 阅读全文
posted @ 2012-05-21 22:59 尔滨之夏 阅读(190) 评论(0) 推荐(0) 编辑
摘要: 其中还有闰年的求法#include<stdio.h>int main(){ int a[12]={31,28,31,30,31,30,31,31,30,31,30,31}; int m,i,n,b,c; while(scanf("%d/%d/%d",&n,&b,&c)!=EOF) { m=0; if((n%4==0&&n%100!=0)||(n%400==0)) a[1]=29; else a[1]=28; ... 阅读全文
posted @ 2012-05-20 08:42 尔滨之夏 阅读(126) 评论(0) 推荐(0) 编辑
摘要: 用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) 编辑
摘要: #include<stdio.h>int main(){int j=16,h=40,z,w;z=h/2-j;w=j-z;printf("兔数是:%d\n鸡数是:%d\n",z,w);return 0;}首先是分析,运用代数知识可知,Z=h/2-j;w=j-z;然后输出即可 阅读全文
posted @ 2012-05-14 21:55 尔滨之夏 阅读(220) 评论(0) 推荐(0) 编辑
摘要: 定义个函数,求最大的数,主函数再调用实现#include<stdio.h>int big(int a,int b){ int c; if(a>b) c=a; else c=b; return c;}int main(){ int a,b; while(scanf("%d%d",&a,&b)!=EOF) { printf("%d\n",big(a,b)); } return 0;} 阅读全文
posted @ 2012-05-14 20:49 尔滨之夏 阅读(145) 评论(0) 推荐(0) 编辑
摘要: 题意:分析:View Code #include<stdio.h>int main(){ int t,h,Ai,Bi,i,j; while(scanf("%d",&t)!=EOF) { while(scanf("%d%d",&Ai,&Bi)!=EOF) { for(i=1;i<=Bi;i++) { printf(">+"); for(j=1;j<=Ai-2;j++) { ... 阅读全文
posted @ 2012-05-12 08:17 尔滨之夏 阅读(124) 评论(0) 推荐(0) 编辑
上一页 1 ··· 5 6 7 8 9