I am using VC++ and am trying to figure out how to do a loop such that when the user enters a char of str the program will display error and ask the user to retry. I have it working for numbers but dont know how to solve the other invalid entry of letters. Any ideas?
Code:void menu (int &selection) { cout << " Available Currencies Menu" << endl << endl; //Display Menu cout << "1. British Pounds" << endl; cout << "2. Canadian Dollars" << endl; cout << "3. Indian Rupees" << endl; cout << "4. Japanese Yens" << endl; cout << "5. Mexican Pesos" << endl << endl; cout << "Please enter your selection number from the list above: # "; //user enters menu selection cin >> selection; //validate selection while (selection < 1 || selection > 5) //user entry validated { cout << "Invalid Entry! Please Enter Number Between 1-5" << endl; //if invalid, error displayed cout << "Please try again: # "; //user enters menu selection cin >> selection; }//end while }//end menu selection function