If I have this snippet of code in an implementation file:
Can I use "messageStr" again in this next catch?Code:cout << "Please select from one of the following destinations (Enter the first letter only):" << endl; cout << "(C)hicago" << endl; cout << "(N)ew York" << endl; cout << "(D)enver" << endl; cout << "(O)rlando" << endl; cout << "(L)os Angeles" << endl; cout << "(R)eturn to Main Menu" << endl; cin >> destination; //==============Start of Exception handling===================== if (destination != "c" || destination != "C" || destination != "n" || destination != "N" || destination != "d" || destination != "D" || destination != "o" || destination != "O" || destination != "l" || destination != "L" || destination != "r" || destination != "R") throw str; }//==============end of try============= catch(string messageStr) { cout << messageStr << endl << endl; system("pause"); cin.clear(); cin.ignore(10,'\n'); }//==============end of catch============= }//==============end of do=============== cout << endl; if (destination == 'R' || destination == 'r') return; //==================Class Choice================== do { try { cout << "Will the customer be traveling First Class or Economy Class?" << endl; cout << "(1) First Class" << endl; cout << "(2) Economy Class" << endl; cin >> reserveType; //=================Start of exception handling=================== if (reserveType != 1 || reserveType != 2) throw str; }//==============end of try============= catch(string messageStr)