Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // this is the problem
- for(i = 0; (c = getchar()) != EOF; ++i) {
- if (c == 't') {
- for (n = i; n < (TAB + n); n++) {
- s[n] = ' ';
- }
- i = n;
- }
- #define MAXLINE 1000
- #define TAB 8
- int main (void)
- {
- int c, i, j, n, counter;
- int s[MAXLINE] = {0};
- counter = 0;
- for(i = 0; (c = getchar()) != EOF; ++i) {
- if (c == 't') {
- for (n = i; n < (TAB + n); n++) {
- s[n] = ' ';
- }
- i = n;
- }
- if (counter++ == COLUMN) {
- s[i++] = c;
- s[i] = 'n';
- counter = 0;
- }
- else {
- s[i] = c;
- }
- }
- // print array
- for(j = 0; j < i; ++j) {
- putchar(s[j]);
- }
- }
Add Comment
Please, Sign In to add comment