How to use enum with user input in c++
c++, enums
Solution
R, P and S are technically now identifiers for numbers (0,1 and 2, respectively). Your program now does not know that that 0, 1 and 2 once mapped to letters or strings.
Instead, you must take the input and manually compare it to "R", "P" and "S" and if it matches one, set the `userThrow` variable accordingly.
Problem
Im making a simple rock paper scissors game and I need to use the enumeration data structure. My problem is that i cannot compile the following code because of an invalid conversion from int (userInput) to Throws (userThrow). ``` enum Throws {R, P, S}; int userInput; cout << "What is your throw : "; cin >> userInput; Throws userThrow = userInput; ``` Help?!