char letter;
cout << "Enter a letter to see the corresponding number on the telephone" << endl;
cin >> letter;
while (letter != '$') {
switch (letter) {
case'A':
case'B':
case'C':
cout << "The number is 2 on the telephone.";
cout << endl;
break;
case'D':
case'E':
case'F':
cout << "The number is 3 on the telephone.";
cout << endl;
break;
case'G':
case'H':
case'I':
cout << "The number is 4 on the telephone.";
cout << endl;
break;
case'J':
case'K':
case'L':
cout << "The number is 5 on the telephone.";
cout << endl;
break;
case'M':
case'N':
case'O':
cout << "The number is 6 on the telephone.";
cout << endl;
break;
case'P':
case'R':
case'S':
cout << "This number is 7 on the telephone.";
cout << endl;
break;
case'T':
case'U':
case'V':
cout << "The number is 8 on the telephone.";
cout << endl;
break;
case'W':
case'X':
case'Y':
cout << "The number is 9 on the telephone.";
cout << endl;
break;
case'Q':
default:
cout << endl;
cout << "Invalid entry" << endl;
}
cin >> letter;
}