Heres my simple code.
But nothing displays on the screen who wins the match of the game.
Can someone help me how to make the program execute from the first again after displaying the match results and press Enter?
Code:
#include <stdio.h>
int main()
{
int user_choice1;
int user_choice2;
printf("This is a rock, paper, and scissor game. \nPlease select 1 for Rock, 2 for Paper, and 3 for Scissors.");
printf("\nPlayer One's Choice: ");
scanf("%d", &user_choice1);
printf("\nPlayer Two's Choice: ");
scanf("%d", &user_choice2);
{
if ((user_choice1==1)&&(user_choice2==1))
{
printf("\nNobody Wins");
}
else if ((user_choice1==1)&&(user_choice2==2))
{ printf("\nPaper Covers Rock");
}
else if ((user_choice1==1)&&(user_choice2==3))
{ printf("\nRock Breaks Scissors");
}
else if((user_choice1==2)&&(user_choice2==1))
{ printf("\nPaper Covers Rock");
}
else if((user_choice1==2)&&(user_choice2==2))
{ printf("\nNobody Wins");
}
else if((user_choice1==2)&&(user_choice2==3))
{ printf("\nScissors Cuts Paper");
}
else if((user_choice1==3)&&(user_choice2==1))
{ printf("\nRock Breaks Scissors");
}
else if((user_choice1==3)&&(user_choice2==2))
{ printf("\nScissors Cuts Paper");
}
else if((user_choice1==3)&&(user_choice2==3))
{ printf("\nNobody Wins");
}
else
{ printf("You have select an invalid selection.");
}
}
}