|
|
вернуться в форумCan I use "gets(str)"? Because the input info states that "The single line of the input contains a sequence" ... The "Single" line but I got #1WA here's my code: #include<stdio.h> char str[10005],output[85],temp; int i,ptr; main() { /* while (scanf("%c",&temp)!=EOF) { if (temp >= 32) str[i++]=temp; } */ gets(str);
for (i=0;str[i];i++) { if (str[i]=='>') { if (output[ptr]!=0) { ptr++; if (ptr==80) ptr=0; } } else if (str[i]=='<') { if (ptr>0) ptr--; }
else { output[ptr]=str[i]; ptr++;
if (ptr==80) ptr=0; }
} printf("%s",output); scanf(" "); } Where is my mistake? Thanks :) Re: Can I use "gets(str)"? ты строчку длины 85 выводишь |
|
|