I am trying to make a Rock-Paper-Scissor game in C++ in Visual Studio.
I am trying to make the computer generated response, but when I make the if
statements, it thinks it is an error on line 9:
#include <iostream>
using namespace std;
string rockPaperScissor;
int computerChoiceInteger = 1 + (rand() % 3);
if (computerChoiceInteger == 1) {
cout << "1";
}
if (computerChoiceInteger == 2) {
cout << "2";
}
if (computerChoiceInteger == 3) {
cout << "3";
}
int main() {
cout << "Rock, paper or scissor?\n";
cout << "R=Rock P=Paper S=Scissor\n";
cin >> rockPaperScissor;
if (rockPaperScissor == "r" || "R") {
cout << "correct";
}
if (rockPaperScissor == "p" || "P") {
cout << "correct";
}
if (rockPaperScissor == "s" || "S") {
cout << "correct";
}
}
I have tried to comment out the first if
statement, but then it says there is an error on line 13.