#include <stdio.h>
main() { char ch,nch; /* */ int count; /* */ int k; /* */
printf("Please input a string with a # in the end.\n"); scanf("%c",&ch); /* */ while(ch != '#') /* */ { if(ch >= '0' && ch <= '9') { /* */ count = ch-'0'+1; /* */ scanf("%c",&nch); /*此处输入a */ for(k=0;k<count;k++) /*若我输入ch为4 */ printf("%c",nch);/*此处应该输出为aaaaa,可是输出的却是a,而且是向下跳了'c'行后输出a,为什么?*/ } else printf("%c",ch); /* */ printf(" "); /* */ scanf("%c",&ch); /* */ } // printf("#\n"); /* */ }
#include <stdio.h> main() { int a=5,b,c,i=10; b=a++;/*a=6,b=5*/ c=++b;/*c=6,b=6*/
printf("a = %d, b = %d, c = %d\n",a,b,c);/*a=6,b=6,c=6*/ printf("i,i++,i++ = %d,%d,%d\n",i,i++,i++); /*10,10,11此处输出为10,10,10,最后的10为何?VC++6.0*/ /*12,11,10此处输出为12,11,10,为何?TC2.0*/ printf("%d\n",++i);/*13*/ printf("%d\n",--i);/*12*/ printf("%d\n",i++);/*12*/ printf("%d\n",i--);/*13*/ printf("%d\n",i);/*12*/ printf("%d\n",-i++);/*-12*/ printf("%d\n",i);/*13*/ printf("%d\n",-i--);/*-13*/ getchar(); } |