Hey guys,
I’m trying to do the “Rock Paper Scissors” project, but am receiving an error saying I did an invalid conversation from ‘const char*’ to ‘int’ in the code if (user = rock)
and if (user = paper)
. I don’t get why it is saying this.
Here’s all my code:
#include <iostream>
#include <stdlib.h>
#include <string>
int main() {
srand (time(NULL));
int computer = rand() % 3 + 1;
int user;
std::cout << "rock paper scissors:\n";
std::cout << "1\n";
std::cout << "2\n";
std::cout << "3\n";
std::cout << "shoot!\n";
std::cin >> user;
int usernumber = 0;
if (user = "rock") {
usernumber = 1;
}
else if (user = "paper") {
usernumber = 2;
}
}
Also, here is a screenshot of the error: