You need to put the entire clause for the if statement in {}'s. Right now, the logic says if (isalpha(ch)) cout << "...";
Because there are no {}'s, that is all that is controlled by the if statement.
If you want everything from the cout to the end of the switch, you need to move the "{" after the cout to before the cout.
Note: please use code tags. It makes it much easier to read and comment on your code. Click the button that looks like "<>" and paste your code between the generated tags.