|
|
back to boardI'm angry! I wrote program on C++ and got WA1. I rewrote program on Pascal and got AC. I think my error in input string. How do i read lines? My attempts: 1) int c; n=0; while ((c = getchar()) != EOF) { if(c=='\n') break; s[++n]=c; } m=0; while ((c = getchar()) != EOF) t[++m]=(char)c; 2) void Input() { int c; scanf("%c",&c); n=0; while (c!='\n') { s[++n]=c; scanf("%c",&c); } m=0; while ((c = getchar()) != EOF) t[++m]=(char)c; } Probably <string> will help, but i prefer work with index>=1. Edited by author 22.06.2017 23:44 Edited by author 22.06.2017 23:44 |
|
|