Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #define TABSTOP 8
- int main ()
- {
- char character;
- char string[100];
- int index = 0;
- int numberOfCharactersBehindTheTabNextStop = 0;
- while ((character = getchar()) != EOF) {
- numberOfCharactersBehindTheTabNextStop++;
- if (string[index] == '\t') {
- while (numberOfCharactersBehindTheTabNextStop < TABSTOP)
- {
- string[index] = ' ';
- index++;
- numberOfCharactersBehindTheTabNextStop++;
- }
- if (numberOfCharactersBehindTheTabNextStop == TABSTOP)
- numberOfCharactersBehindTheTabNextStop = 0;
- } else
- string[index] = character;
- index++;
- }
- for (int index2 = 0; index2 < 100; index2++)
- printf("%c",string[index2]);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement