so I've been picking up C++ during my free time, and I'm trying to build a simple rock paper scissors game. I get a "not defined in this scope error" for x, y and z when I try to run this.
#include <iostream>
#include <stdlib.h>
#include <string>
int main(){
string x,y,z;
srand (time(NULL));
int computer = rand() % 3 + 1;
int user = 0;
std::cout << "====================\n";
std::cout << "rock paper scissors!\n";
std::cout << "====================\n";
std::cout << "1) ✊\n";
std::cout << "2) ✋\n";
std::cout << "3) ✌️\n";
std::cout << "shoot! ";
std::cin >> user;
if(user== 1){
x = (computer == 3) ? "You win!" : "You lose.";
std::cout<<x;
}else if(user==2){
y = (computer == 1) ? "You win!" : "You lose.";
std::cout<<y;
}else{
if(user == 3){
z = (computer == 2) ? "You win!" : "You lose.";
std::cout<<z;
}
}
}
What seems to be the problem?