but that was outputting the wrong code e.g. if i typed 'hello my name is' it outputs hellmnamis. I have a feeling it has something to do with the value of i and the position of the array shifting place because of it?
I then found this which i will probably use anyway:
1 2 3 4 5 6 7 8 9
// Here's the STL algorithm to remove spaces (or whatever char you specify)
remove( s.begin(), s.end(), ' ' );
cout << "I don't like spaces.\n"
<< s
<< endl;
return EXIT_SUCCESS;
}
Would still be nice to know why this doesn't work and if there is any way of making it work? Thanks.