Well that sort of works but if the char I want to delete/erase is at the end of the string my compiler crashes. I dont understand how to delete/erase a char that is not an alphanumeric type.
int i=0;
string aWord = "abcdf!";
while(aWord[i])
{
if(isalpha(aWord[i]))printf ("character %c is alphabetic\n",aWord[i]);
else
aWord.erase (i, 1);
i++;
}
cout<<aWord;
Last edited by JackDurden; Dec 2nd, 2008 at 3:56 pm.
Reputation Points: 10
Solved Threads: 0
Junior Poster in Training
Offline 92 posts
since Jun 2008