-
You're still implementing a second loop, which is unnecessary and again, over complicates things.
My last post gave you all the code necessary to remove duplicate chars (including spaces).
You should simplify your code before moving on, or you will find it more confusing later on.
-
Sometimes I just need a hit to the head.
It does work and it does remove reapeating characters and extra white spaces from the space bar but I could not get it to remove extra spaces due to tabs
Code:
do
{
//Read input data 1 character at at time
while((current = cin.get()) != '/n')
{
if(current != previous)
{
cout << current;
previous = current;
}
}
cout << endl << endl;
} while(current == '\n');
return 0;
}
That is why I went to the other code. I handled the words white spaces and tabs but I would have to add to it to remove the repeating characters. I have tried to add
Code:
if(previous == '\t' && current != ispace(current))
{
putchar(' ');
}
I just cant figure out how to get rid of unwanted tabs this way. Any suggestions?
-
I think I got! I'll be testing it when I get home.