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.
string aWord = "abcdf!";
if(isalpha(aWord[i]))printf ("character %c is alphabetic\n",aWord[i]);
aWord.erase (i, 1);
Your program ran for me. I don't know what error you got, but if it is an index-out-of-range/segmentation fault error, you may want to change this:
while (i < aWord.length ())
That might make a difference, might not. As to your other problem, only increment i if aWord is a letter. erase and replace will cause the indexes to change, so some characters will be skipped if you use erase/replace AND increment i.
public class GrossmontBank
//class variables (global - accessible throughout this class)
//scanner object to be used throughout
private static Scanner input = new Scanner(System.in);