So I am writing a 'simple' childish code that will determine if the player or the computer will go first.
( I KNOW IT IS STUPID THATS WHY I MADE IT)
#include<iostream>
int main()
{
std::cout<<"announcer:\"today we are going to witness a roast battle bettween ZAK AND...\""<<std::endl;
std::cout<<"announcer **whispers**:\"wait what was your name again?"<<std::endl;
std::string player;
getline(std::cin,player);
std::cout<<"announcer:\"ZAK AND "<<player<<"!!!!!!!!\""<<std::endl;
std::cout<<" \"now we need to decide who will go first,reff do your stuff.\""<<std::endl;
std::cout<<"reff:\"choose heads or tails if you think heads type 1 if tails the 2\""<<std::endl;
int num1;
std::cin>>num1;
int flip =rand() % 3+ 1 ;
//to show me what the number was
std::cout<<flip<<std::endl;
if(num1 = flip ){
if(num1 = 1){
std::cout<<"it was heads so "<<player<<" will go first"<<std::endl;
}else{
std::cout<<"it was tails so "<<player<< " will go first"<<std::endl;
}
}else{
if(num1 = 1){
std::cout<<"it was tails so zak will go first"<<std::endl;
}else{
std::cout<<"it was heads so zak will go first"<<std::endl;
}
}
}
*******************************************************************************
but whenever i get to the if then statement at the bottom of the code it will output "it was head so player will go first"
regardless if the player chose 2 plz help!!!