Why not just use -1 to end, since the program is meant to change the case to upper and lower then the program should stop or at least print an error message when it encounters a non alphabetic character.
Code:
// upper lower case conversion prblm 1 pg 137
#include <iostream>
#include <cctype>
using namespace std;
int main(void)
{
char ch;
cout<<"Changes lower case to upper and upper to lower case.\n";
cout<<"Enter a phrase (-1 to exit):";
cin.get(ch);
while(ch != '-1'){
if(isalpha(ch)){
if(islower(ch))
ch=toupper(ch);
else
ch=tolower(ch);
cout<<ch<<flush;
}else{
cout<<"input not valid!"<<flush;
cin.get(ch);
}
return 0;
}