I posted a thread before, but I have recoded since. All my function prototypes are now in my header file, and their definitions are in my *.cpp file. The function I am having trouble with seems to freeze the program right after it outputs the "product code" letter I enter. I enter a letter, it outputs the upper case version of that letter, then nothing seems to happen. Here is the code again:
The prompt is printed, I enter the letter (like "a"), the toupper(c) changes it to "A", the "A" is printed to the screen, and then nothing more happens. What could be the problem? Any help is greatly appreciated since this program is due tonight!Code:char accept_item_code () { char c; cout << endl << "--------------------" << endl; cout << "Enter product code: "; cin >> c; c = toupper(c); cout << c; cout << endl; cout << "BEFORE WHILE LOOP"; // DEBUGGING while (c != 'A' && c !='B' && c !='C' && c !='D' && c !='E' && c !='F'&& c !='G' && c !='H' && c !='I' && c !='X') { cout << "INSIDE WHILE LOOP"; // DEBUGGING cout << "!!! Invalid product code" << endl << endl << "Enter product code: "; cin >> c; c = toupper(c); cout << endl; } cout << "RETURNING ITEM CODE FROM FUNCTION"; // DEBUGGING return c; }
Josh Stevanus
[email protected]