Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #define MAXTSPACE 8
- int main()
- {
- int c, i, spacecnt;
- i = 0;
- spacecnt = MAXTSPACE;
- while((c = getchar()) != EOF ) {
- if(c == '\t') {
- for(i = 0; i < spacecnt; ++i)
- printf(" ");
- spacecnt = MAXTSPACE;
- } else if(c == '\n') {
- spacecnt = MAXTSPACE;
- putchar(c);
- } else {
- putchar(c);
- --spacecnt;
- if(spacecnt > 1)
- spacecnt = MAXTSPACE;
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment