haha1235  

2013年10月7日

摘要: #include int main(void){ int col,i,j,row; int a[3][2]; printf("Enter 6 integers:\n"); for(i=0;ia[row][col]){ row=i; col=j; } printf("max=a[%d][%d]=%d\n",row,col,a[row][col]); return 0; } 阅读全文
posted @ 2013-10-07 16:59 haha1235 阅读(134) 评论(0) 推荐(0) 编辑
 
摘要: #includefloat cash;int main(void){ int choice; float value; void income(float number),expend(float number); cash=0; printf("Enter operate choice(0--end,1--income,2--expend):"); scanf("%d",&choice); while(choice!=0){ if(choice==1||choice==2){ printf("Enter cash ... 阅读全文
posted @ 2013-10-07 15:43 haha1235 阅读(152) 评论(0) 推荐(0) 编辑
 
摘要: #include int main(void){ int i,flag,x; int a[5]; printf("Enter 5 integers:"); for(i=0;i<5;i++) scanf_s("%d",&a[i]); printf("Enter x:"); scanf_s("%d",&x); flag=0; for(i=0;i<5;i++) if(a[i]==x){ printf("Index is %d\n",i); flag=1; break; } 阅读全文
posted @ 2013-10-07 12:03 haha1235 阅读(131) 评论(0) 推荐(0) 编辑
 
摘要: #include int main(void){ char ch; printf("input characters:"); ch=getchar(); while(ch!='\n'){ if(ch>='A'&&ch='a'&&ch<='z') ch=ch-'a'+'A'; putchar(ch); ch=getchar(); } return 0;} 阅读全文
posted @ 2013-10-07 11:58 haha1235 阅读(130) 评论(0) 推荐(0) 编辑
 
摘要: #include int main(void){ int i; char ch_lower,ch_upper; for(i=1;i='a'&&ch_lower%c->%d\n",ch_lower,ch_upper,ch_upper%10); } return 0;} 阅读全文
posted @ 2013-10-07 11:56 haha1235 阅读(115) 评论(0) 推荐(0) 编辑
 
摘要: #include int main(void){ int x; printf("Enter x:"); scanf_s("%d",&x); while(x!=0){ printf("%d",x%10); x=x/10; } return 0;} 阅读全文
posted @ 2013-10-07 11:49 haha1235 阅读(90) 评论(0) 推荐(0) 编辑
 
摘要: #include int main(void){ int mynumber=38; int count=0,yournumber; for(count=1;countmynumber) printf("Sorry!your number is bigger than my number!\n"); else printf("Sorry!your number is smaller than my number!\n"); } printf("Game is over!\n"); return 0;} 阅读全文
posted @ 2013-10-07 11:44 haha1235 阅读(101) 评论(0) 推荐(0) 编辑
 
摘要: #include int main(void){ int i,m; printf("Enter a number:"); scanf_s("%d",&m); for(i=2;im/2&&m!=1) printf("%d is a prime number!\n",m); else printf("No!\n"); return 0;} 阅读全文
posted @ 2013-10-07 11:43 haha1235 阅读(116) 评论(0) 推荐(0) 编辑
 
摘要: #include int main(void){ int count,number; count=0; printf("Enter a number:"); scanf_s("%d",&number); if(number<0)number=-number; do{ number=number/10; count++; }while(number!=0); printf("It contains %digits.\n",count); return 0; } 阅读全文
posted @ 2013-10-07 11:40 haha1235 阅读(107) 评论(0) 推荐(0) 编辑
 
摘要: #includeint main(void){ int blank,digit,other; char ch; int i; blank=digit=other=0; printf("Enter 10 characters:"); for(i=1;i<=10;i++){ ch=getchar(); switch(ch){ case' ': case'\n': blank++; break; case'0':case'1':case'2':case'3':case'4 阅读全文
posted @ 2013-10-07 11:32 haha1235 阅读(76) 评论(0) 推荐(0) 编辑