I’m writing a very simple program where I want to get user input from the standard input stream (keyboard) and then do something based on what input I encountered. However, the problem is that sometimes the input will be a number (double) while othertimes it’ll be a string. I’m not sure exactly what methods calls I need in order to parse it properly (perhaps something similar to Integer.parseInt in java).
Here is some pseduocode of what I would like to do:
cin >> input
if(input is equal to "p") call methodA;
else if(input is a number) call methodB;
else call methodC;
I think this is what you need:
Hope this helps 😉