摘要:
C语言编程有感“别人国庆潇洒,我们日夜代码。”刚开始我确实觉得很憋屈,但是渐渐地,在编写程序的过程中,我明白了很多。C语言是一门实验性很强的课程,越过动手操作环节而去谈编程简直是天方夜谭,就好像是拿着空碗吃饭,吃到的是虚无缥缈的东西,实质的东西是吃不到的。就算课本上的东西能倒背如流,实际操作中也是一片空白。当今社会,缺少的不是拥有文凭的人,而是确确实实拥有实际动手能力的人才。在编程领域,实际动手操作能力就显得尤为重要了。应聘公司是不会招聘一个“满腹经纶”的“瘫患者”去充当兰郭先生的。一个熟读武学秘籍却拿不起大刀的人是没有任何战斗力的,他终将被残酷公平的社会所淘汰。在经过这几日的练习之后,我才. 阅读全文
摘要:
#includeint main(void){ int i,k; char str1[80],str2[80]; long number; printf("Enter a string:"); i=0; while((str1[i]=getchar())!='\n') i++; str1[i]='\0'; k=0; for(i=0;str1[i]!='\0';i++) if (str1[i]>='0'&&str1[i]='a'&&str1[i]='A 阅读全文
摘要:
#includeint main(void){ int count,i; char str[80]; printf("Enter a string:"); i=0; while((str[i]=getchar())!='\n') i++; str[i]='\0'; count=0; for(i=0;str[i]!='\0';i++) if(str[i]='0') count++; printf("count=%d\n",count); return 0;} 阅读全文
摘要:
#includeint main(void){ int i,number; char str[10]; printf("Enter a string:"); i=0; while((str[i]=getchar())!='\n') i++; str[i]='\0'; number=0; for(i=0;str[i]!='\0';i++) if(str[i]>='0'&& str[i]<'9') number=number*10+str[i]-'0'; 阅读全文
摘要:
#includeint main(void){ int i,n,m; char s[10]; printf("Enter a string:"); i=0; while((s[i]=getchar())!='\n') i++; s[i]='\0'; for(n=0,m=i-1;n=m) printf("It is a plalindrome\n"); else printf("It is not a plalindrome\n"); return 0;} 阅读全文
摘要:
#includeint main(void){ int i,j,n,temp; int a[6][6]; printf("Enter n:"); scanf("%d",&n); for(i=0;i<n;i++) for(j=0;j<n;j++) a[i][j]=i*n+j+1; for(i=0;i<n;i++) for(j=0;j<n;j++) if(i<=j){ temp=a[i][j]; a[i][j]=a[j][i]; a[j][i]=temp; } for(i=0;i<n;i++){ for(j=0;j 阅读全文
摘要:
#includeint main(void){ int i,j; int a[3][2]; for(i=0;i<3;i++) for(j=0;j<2;j++) a[i][j]=i+j; for(i=0;i<3;i++){ for(j=0;j<2;j++) printf("%4d",a[i][j]); printf("\n"); } return 0;} 阅读全文
摘要:
#includeint 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;} 阅读全文
摘要:
#includeint main(void){ int a[10]={1,2,3,4,5,6,7,8,9,10}; int low,high,mid,n=10,x; printf("Enter x:"); scanf("%d",&x); low=0;high=n-1; while(lowint main(void){ int a[10]={1,2,3,4,5,6,7,8,9,10}; int low,high,mid,n=10,x; printf("Enter x:"); scanf("%d",&x 阅读全文
摘要:
#includeint main(void){ int i,index,n; int a[10]; printf("Enter n:"); scanf("%d",&n); printf("Enter %d integers:",n); for(i=0;i<n;i++) scanf("%d",&a[i]); index=0; for(i=1;i<n;i++) if(a[i]<a[index]) index=i; printf("min is %d\tsub is%d\n&q 阅读全文
摘要:
#includeint main(void){ int i,index,k,n,temp; int a[10]; printf("Enter n:"); scanf("%d",&n); printf("Enter %d integers:",n); for(i=0;i<n;i++) scanf("%d",&a[i]); for(k=0;k<n-1;k++){ index=k; for(i=k+1;i<n;i++) if(a[i]<a[index]) index=i; temp 阅读全文
摘要:
#includeint main(void){ int i; int fib[10]={1,1}; for(i=2;i<=10;i++) fib[i]=fib[i-1]+fib[i-2]; for(i=0;i<=10;i++){ printf("%6d",fib[i]); if((i+1)%5==0) printf("\n"); } return 0;} 阅读全文
摘要:
#includeint main(void){ int i,flag,x; int a[5]; printf("Enter 5 integers:"); for(i=0;i<5;i++) scanf("%d",&a[i]); printf("Enter x:"); scanf("%d",&x); flag=0; for(i=0;i<5;i++) if(a[i]==x){ printf("Index is %d\n",i); flag=1; break; } if(fl 阅读全文
摘要:
#includeint main(void){ int count[9]; int i,response; for(i=1;i8) printf("this is a bad response:%d\n",response); else count[response]++; } printf("result:\n"); for(i=1;i<=8;i++) printf("%4d%4d\n",i,count[i]); return 0;} 阅读全文
摘要:
#includeint 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;} 阅读全文
摘要:
#includeint main(void){ char ch='w'; int a=2,b=0,c=0; float x=3.0; printf("%d",a&&b); printf("%d",a||b&&c); printf("%d",!a&&b); printf("%d",a||3+10&&2); printf("%d",!(x==2)); printf("%d",!x==2); print 阅读全文
摘要:
#includeint main(void){ char ch='w'; int a=-2,b=3,c=1,d,x=10; printf("%d",a>b==c); printf("%d",d=a>b); printf("%d",ch>'a'+1); printf("%d",d=a+b>c); printf("%d",b-1==a!=c); printf("%d\n",3<=x<=5); return 0;} 阅读全文
摘要:
#includedouble fact_s(int n);int main(void){ int i,n; printf("Input n:"); scanf("%d",&n); for(i=1;i<=n;i++) printf("%3d!=%0f\n",i,fact_s(i)); return 0;}double fact_s(int n){ static double f=1; f=f*n; return(f);} 阅读全文
摘要:
#includeint 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;} 阅读全文
摘要:
#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){ printf("Enter cash value:"); scanf( 阅读全文