Function userInput
The userInput
function provides a means to accessing a single
value from the user. Each invocation outputs a provided
statement/question
and takes an entire line of input. The result
is then
converted to the requested type; default is a string.
auto name = userInput("What is your name"); //or string name; userInput("What is your name", name);
Prototypes
T userInput(T)( string question = "" ); void userInput(T)( string question, ref T result );
Returns
User response as type T.
Where type is bool:
true on "ok", "continue", and if the response starts with 'y' or 'Y'.
false on all other input, include no response (will not throw).
Throws
NoInputException
if the user does not enter anything.
ConvError when the string could not be converted to the desired type.
Authors
Jesse Phillips
Copyright
Copyright Jesse Phillips 2010
License
zlib/libpng