| PPAC13 (3) | |||
Hey guys/gals I need some serious help before I go insane. I've written this function with the intent to give users the choice and once the choice is selected to go to the other function and do its thing. My problem is when it runs and I choose action, it completes its purpose and it repeats the action function. The same for the other two (strength and diagnosis). I've tried placing option() again after action is called in the same if statement to see what would happen. After I did so the menu came up and no matter what I select the action function keeps repeating. I've tried choosing to quit after action or any of the other functions are called and it wouldn't quit. The only way the program quits is if quit is my first option. I know one solution is just to put exit(), but I don't want to do that. I want the variables and statements to do what they are supposed to. I would hate to find out it's some minor foolishness. | |||
|
|
|||
| Smac89 (201) | |
| Use else if's instead of all ifs. And your line 41's second condition is doing nothing because as long as the user has not entered anything, getline will still be waiting for input | |
|
|
|
| MiiNiPaa (232) | |
long as the user has not entered anything, getline will still be waiting for input Nope. getline() will store all characters it encounter into response until delimeter (default '\n') is found. Then it discards it and stops. If user just presses enter, getline will store an empty string. | |
|
Last edited on
|
|