I'm working on a problem in which I've to design a program in which the punctuations should be removed from the string. For eg., if input str is: "Hello!!"; the output must be: "Hello".
I'm not sure how to remove a sub-string (if that's the right word!!) from a string. So, I designed a program which print out the punctuations. For eg., if input str is: "Hey!!"; the output would be: ! !
Here it is:
1 2 3 4 5 6 7 8 9 10 11 12 13 14
int main ()
cout << "Enter a string" << endl;
cin >> str;
for (string::size_type index = 0; index != str.size(); ++index)
if (ispunct (str[index]))
cout << str[index] << endl;
So, I want to know what should be added to this program so that the punctuations can be removed; or should I rewrite another program for that? Kindly help me...