executing a function by user input???

Jul 31, 2011 at 4:44am
How would you have a function execute only by the user inputing specific characters (like info) anywhere in the program, regardless of what function was currently being executed.

and then return to that spot in the function that the were at after.
Jul 31, 2011 at 11:07am
You could append if( my_input == "info" ) do_stuff_with_info(); to every place where you have input, but that would be just ludicrous.

You could write a function get_input() which would check if the user entered "info" and use that instead of std::getline.

You could structure your program in such way that you only have input in one place. You would probably use state variables to make it work..
Topic archived. No new replies allowed.