会员
众包
新闻
博问
闪存
赞助商
HarmonyOS
Chat2DB
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
尔滨之夏
博客园
首页
新随笔
联系
管理
订阅
上一页
1
···
5
6
7
8
9
2012年5月22日
将一个数反着输出
摘要: 运用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 尔滨之夏
阅读(224)
评论(0)
推荐(0)
2012年5月21日
输出数的每一位数
摘要: 运用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 尔滨之夏
阅读(193)
评论(0)
推荐(0)
2012年5月20日
求第几天
摘要: 其中还有闰年的求法#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 尔滨之夏
阅读(128)
评论(0)
推荐(0)
2012年5月19日
多分支结构
摘要: 用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 尔滨之夏
阅读(217)
评论(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 尔滨之夏
阅读(312)
评论(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 尔滨之夏
阅读(127)
评论(0)
推荐(0)
输入三个字母,比较AISS码大小
摘要: 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 尔滨之夏
阅读(991)
评论(0)
推荐(0)
2012年5月14日
知道了鸡和兔的头数16和脚数40,求鸡和兔的数
摘要: #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 尔滨之夏
阅读(226)
评论(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 尔滨之夏
阅读(149)
评论(0)
推荐(0)
2012年5月12日
HLG 狗的题
摘要: 题意:分析: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 尔滨之夏
阅读(129)
评论(0)
推荐(0)
上一页
1
···
5
6
7
8
9
公告