Soo.. heres my problem. My goal in here is to make a program that allows you to play rock paper and scissors. 0 being the rock, 2 being the scissor and 5 being the paper. As long as you use rock (player 1), the program would look like okay but if you try out the other choices, well meh. Anw I'm just a newbie so.. can you please help me out? Thanks
Code:
#include <stdio.h>
#include <conio.h>
int main ()
{
char p [80], q [80],p1 ,p2 ;
printf ("Our First Challenger is?: ");
gets (p);
printf ("\nOur Second Challenger is?: ");
gets (q);
printf ("\nLet the Game of Janken Begin!");
printf("\n\n%s throws a: ", p);
scanf("%s", &p1);
printf("\n%s throws a: ", q);
scanf("%s", &p2);
if (p1=='0' || p2=='2')
{
printf ("\n %s wins this round!", p);
}
else if (p1=='0'|| p2=='5')
{
printf ("\n %s wins this round!",q);
}
else if (p1=='0' || p2=='0')
{
printf ("\n %s,%s Its a tie :)",p,q);
}
else if (p1=='2' || p2=='5')
{
printf ("\n %s wins this round!", p);
}
else if (p1=='2'|| p2=='0')
{
printf ("\n %s wins this round!",q);
}
else if (p1=='2' || p2=='2')
{
printf ("\n %s,%s Its a tie :)",p,q);
}
else if (p1=='5' || p2=='0')
{
printf ("\n %s wins this round!", p);
}
else if (p1=='5'|| p2=='2')
{
printf ("\n %s wins this round!",q);
}
else if (p1=='5' || p2=='5')
{
printf ("\n %s,%s Its a tie :)",p,q);
}
return 0;
getch();
}