2012年2月22日
摘要: View Code /*2输入一行字符,分别统计出其中英文字母、空格、数字和其他字符的个数。 #include"stdi0.h" int main() {char a;int i=0,j=0,k=0,l=0; while((c=getchar())!=='\n') {if(c>=65&&c<=90||c>=97&&c<=122) i++; else if(c>=48&&c<=57) j+; else if(c==32) ++; else l++;} printf(" 阅读全文
posted @ 2012-02-22 20:14 C's 阅读(167) 评论(0) 推荐(0)
摘要: View Code /*一、改正下列程序中的编译错误1输入两个正整数m和n,求其最大公约数和最小公倍数。 void main() {lonj m,i=1,j,s; Scanf("%ld%ld",&m,n); for(;i<=m&&i<=n;i++) {if(m%i==0&n%i==0) s=i;} if(m>=n) j=m; else j=n; for(;!(j%m==0&&j%n==0;j++); printf("s=%ld,j=%ld\n",s,j); } 改:*/#include&l 阅读全文
posted @ 2012-02-22 20:13 C's 阅读(230) 评论(0) 推荐(0)
  2012年2月17日
摘要: View Code #include<stdio.h>int func(__int64 x){ int h,a; for(h=0;x>0;x=x/10) { a=x%10; h+=a; } return h;}void main(){ __int64 x; while(1) { scanf("%I64d",&x); printf("%d\n",(int)func(x)); }} 阅读全文
posted @ 2012-02-17 11:20 C's 阅读(168) 评论(0) 推荐(0)
摘要: View Code #include<stdio.h>#include<math.h>int prime(int x){ int i; for(i=2;i<=(int)sqrt(x);i++) if(x%i==0) return 0; return 1;}void main(){ int a,b; while(1) { scanf("%d",&a); for(b=2;b<=a;b++) if(prime(b)==1) printf("%d\t",b); }} 阅读全文
posted @ 2012-02-17 11:04 C's 阅读(141) 评论(0) 推荐(0)
  2011年12月29日
摘要: View Code #include <stdio.h>#include <stdlib.h>#include <string.h>#include <math.h>#define MAX 80 #define jwcc 50void NiZhi(int *ShuZu,int len) { int i,t; for(i=0;i<=len/2-1;i++) { t=ShuZu[i]; ShuZu[i]=ShuZu[len-i-1]; ShuZu[len-i-1]=t; ... 阅读全文
posted @ 2011-12-29 14:45 C's 阅读(398) 评论(0) 推荐(0)
  2011年12月20日
摘要: View Code #include <stdio.h>#include <stdlib.h>#include <string.h>#define MAX 80 #define jwcc 50void NiZhi(int *ShuZu,int len) { int i,t; for(i=0;i<=len/2;i++) { t=ShuZu[i]; ShuZu[i]=ShuZu[len-i-1]; ShuZu[len-i-1]=t; } } void Zh... 阅读全文
posted @ 2011-12-20 16:58 C's 阅读(169) 评论(0) 推荐(0)
  2011年12月1日
摘要: View Code #include <stdio.h>#include <stdlib.h>#include <string.h>int tidy(char *a,char *b) { int i,la = strlen(a),lb = strlen(b); if(la < lb) { for(i = 0;i < la;i++) a[lb - i - 1] = a[la - i - 1]; for(i = 0;i < lb - la;i++) a[i] = '0'; a[lb] = '\0'; la = l 阅读全文
posted @ 2011-12-01 16:25 C's 阅读(303) 评论(0) 推荐(0)
  2011年11月27日
摘要: View Code #include <dos.h> /*DOS接口函数*/#include <math.h> /*数学函数的定义*/#include <conio.h> /*屏幕操作函数*/#include <stdio.h> /*I/O函数*/ #include <stdlib.h> /*库函数*/#include <stdarg.h> /*变量长度参数表*/#include <graphics.h> /*图形函数*/#include <string.h> /*字符串函数*/#include & 阅读全文
posted @ 2011-11-27 15:19 C's 阅读(6083) 评论(0) 推荐(0)
摘要: #include<stdio.h>int ctoi(char *p){ int sum=0; while(*p) { sum*=10; sum+=*p-'0'; p++;} return sum;}int main(){ char str[5]; int x; while(scanf("%s",str)!=EOF) { x=ctoi(str); printf("x=%d\n",x); x=x*10; printf("%d\n",x);} return 0;} 阅读全文
posted @ 2011-11-27 14:54 C's 阅读(223) 评论(0) 推荐(0)
摘要: #include <string.h>#include<stdio.h>int main(void){char *s="Golden Global View";printf("%s has %d chars",s,strlen(s));getchar();return 0;}strlen 阅读全文
posted @ 2011-11-27 14:49 C's 阅读(186) 评论(0) 推荐(0)