Advertisement
Guest User

Untitled

a guest
Feb 13th, 2016
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. #include <stdio.h>
  2. #define TABSTOP 8
  3.  
  4. int main ()
  5. {
  6. char character;
  7. char string[100];
  8. int index = 0;
  9. int numberOfCharactersBehindTheTabNextStop = 0;
  10. while ((character = getchar()) != EOF) {
  11. numberOfCharactersBehindTheTabNextStop++;
  12. if (string[index] == '\t') {
  13. while (numberOfCharactersBehindTheTabNextStop < TABSTOP)
  14. {
  15. string[index] = ' ';
  16. index++;
  17. numberOfCharactersBehindTheTabNextStop++;
  18. }
  19. if (numberOfCharactersBehindTheTabNextStop == TABSTOP)
  20. numberOfCharactersBehindTheTabNextStop = 0;
  21. } else
  22. string[index] = character;
  23. index++;
  24. }
  25. for (int index2 = 0; index2 < 100; index2++)
  26. printf("%c",string[index2]);
  27. return 0;
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement