I am writing a program that reads a string from a user and uses it to process a request. After giving a hint, I can expect one of three possible answers in the form:
Depending on what type of command the user gives, the program must perform another task. I have a hard time trying to handle user input. To be clear, the user enters the command as one line, so the example of the user executing the second option may enter "age 8" after the request. In this example, I would like the program to save "age" as a string and "8" as an integer. What would be a good way to get around this?
From what I have compiled here, using strtok () or boost may be the solution. I tried both without success, and it would be very helpful if someone helped make everything clearer. thanks in advance
source
share