#include <stdio.h>
#include <stdlib.h>
// Write a program to copy its input to its output, replacing each tab by \t, each backspace by \b, and each backslash \\. This makes tabs and backspaces bisible in an unambigious way.
int main()
{
int c;
while((c = getchar()) != EOF){
if (c == '\t')
printf("\\t");
else if (c == '\b')
printf("\\b");
else if(c == '\\')
printf("\\\\");
else
putchar(c);
}
}
It simply prints out whatever I type in. I don't understand why it isn't changing the tabs into \t...
Any idea why this wouldn't be working?
Thanks

New Topic/Question
Reply




MultiQuote




|