I am trying this code
int n,k;
enum Throws {R, P, S};
int userInput;
for(int i=0;i<3;i++)
{
cin>>userInput;
cout<<(Throws)userInput;
}
why does this code not take R as input and provide 0 as output and wait for the next input rather gives 000 as output for any of the values expected output: input-R output-0 input-S output-2 input-P output-1 but instead i am getting this input-R(or P or S) output- 000 (exit of loop takes place) not exactly sure how the code is percieving the input as i understand that the enum should act like R=0,P=1,S=2 where in R,P,S should become like integers. what am i doing wrong or if my understanding is wrong?please can someone explain how to do it ? thanks
input output window:
input-R
output-R
input-P
output-P
input-S
output-S
this is what i am trying to get as the output i tried taking enum itself as input but it gives error like
enum Throws q;
cin>>q;
it gives error: no match for ‘operator>>’```