uhm , Guys can anyone help me and tell me what is wrong in my program?
Code:
#include<stdio.h>
int main()
{
int userSel;
int compSel = (rand() % 3) + 1;
int count1;
int x=0;
int y=1;
int z=2;
printf("Welcome to >>>Rock Paper Scissors<<<\n");
printf("");
printf(" So lets begin. You are playing against the computer\n");
printf("");
printf("Type 0 for rock, 1 for paper,and 2 for scissors\n");
if (userSel==0)
{
printf("You chose Rock.");
}
else if (userSel==1)
{
printf("You chose Paper.");
}
else if (userSel==2)
{
printf("You chose scissors.");
}
else
{
printf("Invalid choice.");
return 1;
}
if (compSel==0)
{
printf("Computer chose rock.");
}
else if (compSel==1)
{
printf("Computer chose paper.");
}
else if (compSel==2)
{
printf("Computer chose scissors.");
}
count1++;
if (userSel==compSel)
{
printf("You Tie");
}
if (userSel==0)
{
if (compSel=1)
{
printf("You lose");
}
else if (compSel=2)
{
printf("You win");
}
}
else if (userSel==1)
{
if (compSel==0)
{
printf("You win");
}
else if (compSel==2)
{
printf("You lose");
}
}
else if (userSel==2)
{
if (compSel==1)
{
printf("You lose");
}
else if (compSel==1)
{
printf("You lose");
}
}
}