질문이요...

topgun0209 Reply 9 years 3 weeks ago
#include <stdio.h> #include <stdlib.h> int main() { int n, c, t[500]={0}, n1, n2, n3, i; n=0; while((c=getchar()) !=EOF){ t[n]=c; n++; if (n=20 && c==' '){ for(i=0; i<n; i++) printf("%c", t[i]); printf("\n"); n=0; } else if (n=19 && c==' '){ for(i=0; i<n; i++) printf("%c", t[i]); printf("\n"); n=0; } else if (n=18 && c==' '){ for(i=0; i<n; i++) printf("%c", t[i]); printf("\n"); n=0; } else if (n>=19 && t[18]!=' ' && t[19]!=' ' && t[20]!=' '){ for(n1=19; n1<=n; n1++){ t[n1+2]=t[n1]; t[19]='-'; t[20]='\n'; } for(n2=0; n2<21; n2++){ printf("%c", t[n2]); } for(n3=22; n3<=n; n++) t[n3-22]=t[n3]; n=n-20; } else if (n<18 && c=='\n'){ for(i=0; i<n; i++) printf("%c", t[i]); printf("\n"); n=0; } } return 0; } 이런식으로 20글자 넘을때는 잘라서 다음배열에 넣어주는 식으로 짜보려고 했는데 시작부터 출력이 안되네요... 눈에 보이는(전 안보이지만) 큼직큼직한 버그들좀 잡아주세요...ㅠㅜ 프린트라도 되야 무얼 해보는데...ㅠㅜ
wonbo123 Reply 8 years 31 weeks ago
wonbo123 Reply 8 years 31 weeks ago
여기다가 코드 올리면 안되는거 아닌가? ㅋ