Home > Back-end > Result is right, but always said after running period of mistake, I really don't know where is
Result is right, but always said after running period of mistake, I really don't know where is
Time:04-11
CodePudding user response:
At first glance, the input should be changed like this:
while ((a) [j]=getchar ())! )='\ n' { j++; }
CodePudding user response:
Modified as follows, for your reference:
# include
Int main () { Int I, j, n, m; Char a [1024], w; J=0; The scanf (" % d ", & amp; N); getchar(); While ((a) [j]=getchar ())! )='\ n' { j++; } for(i=1; i<=n; I++) { For (m=1, j w=a, [m]. M> 0; M -) { A [m]=a [m - 1); } A [m]=w; } for(i=0; iPrintf (" % c ", a [I]); }
return 0; }
CodePudding user response:
Fixed upstairs, line 22 increase printf (" \ n "); :
# include
Int main () { Int I, j, n, m; Char a [1024], w; J=0; The scanf (" % d ", & amp; N); getchar(); While ((a) [j]=getchar ())! )='\ n' { j++; } for(i=1; i<=n; I++) { For (m=1, j w=a, [m]. M> 0; M -) { A [m]=a [m - 1); } A [m]=w; } for(i=0; iPrintf (" % c ", a [I]); } printf("\n");