Guest User

Untitled

a guest
Jan 19th, 2018
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. // this is the problem
  2. for(i = 0; (c = getchar()) != EOF; ++i) {
  3. if (c == 't') {
  4. for (n = i; n < (TAB + n); n++) {
  5. s[n] = ' ';
  6. }
  7. i = n;
  8. }
  9.  
  10. #define MAXLINE 1000
  11. #define TAB 8
  12.  
  13. int main (void)
  14. {
  15. int c, i, j, n, counter;
  16.  
  17. int s[MAXLINE] = {0};
  18.  
  19. counter = 0;
  20. for(i = 0; (c = getchar()) != EOF; ++i) {
  21. if (c == 't') {
  22. for (n = i; n < (TAB + n); n++) {
  23. s[n] = ' ';
  24. }
  25. i = n;
  26. }
  27. if (counter++ == COLUMN) {
  28. s[i++] = c;
  29. s[i] = 'n';
  30. counter = 0;
  31. }
  32. else {
  33. s[i] = c;
  34. }
  35. }
  36.  
  37. // print array
  38. for(j = 0; j < i; ++j) {
  39. putchar(s[j]);
  40. }
  41.  
  42. }
Add Comment
Please, Sign In to add comment