I have highlighted the basic problems below. You can probably change your code to use better idioms but for the following should be sufficient for now.
You are comparing characters with const char*
values, this is ill formed code. String literals in C++ of the form "__characters__"
are of the type const char*
, and it does not mean anything to compare these values to characters, a character is a plain and simple character, not a string.
Put an #include <string>
at the top of your program and change the types of c_ch
and p_ch
to be std::string
s and not char
s
Also use an int to assign the rand()
value, and not c_ch
4
solved Rock paper scissor program