Need a C Program that prints this! Player-1 it is your turn! Please enter your c
ID: 3925102 • Letter: N
Question
Need a C Program that prints this! Player-1 it is your turn! Please enter your choice (p)aper, (r)ock, or (s)clssors: why I'm sorry, I do not understand. Please enter your choice (p)aper, (r)ock, or (s)cissors: 42 I'm sorry, I do not understand. Please enter your choice (p)aper, (r)ock, or (s)cissors: Paper! Player-2 it is your turn! Please enter your choice (p)aper, (r)ock, or (s)clssors: r Playerl wins! Paper covers rock! Do you wish to continue? (y/n): y Player-1 it is your turn! Please enter your choice (p)aper, (r)ock, or (s)clssors: s Player-2 it is your turn! Please enter your choice (p)aper, (r)ock, or (s)clssors: Rock on! Player2 wins! Rock breaks scissors! Do you wish to continue? (y/n): n Program ended with exit code: 0Explanation / Answer
#include <stdio.h>
#include <conio.h>
main ()
{
char p1, p2, q;
clrscr ();
printf (" Player-1 it is your turn: ");
p1=getche ();
printf (" Player-2 it is your turn: ");
p2=getche ();
if (((p1=='p')||(p1=='P')) && ((p2=='R') || (p2=='r')))
{
printf (" Player 1 Wins !");
printf (" Paper Covers Rock");
}
else if (((p2=='p') || (p2=='P')) && ((p1=='r') || (p1=='R')))
{
printf (" Player 2 Wins !");
printf ("Paper Covers Rock");
}
else if (((p1=='r') || (p1=='R')) && ((p2=='s') || (p2=='S')))
{
printf (" Player 1 Wins !");
printf ("Rock Breaks Scissors");
}
else if (((p2=='r') || (p2=='R')) && ((p1=='s') || (p1=='S')))
{
printf (" Player 2 Wins !");
printf ("Rock Breaks Scissors");
}
else if (((p1=='s') || (p1=='S')) && ((p2=='p') || (p2=='P')))
{
printf (" Player 1 Wins !");
printf ("Scissors Cut Paper");
}
else if (((p2=='s') || (p2=='S')) && ((p1=='p') || (p1=='P')))
{
printf ("Player 2 Wins !");
printf ("Scissors Cut Paper");
}
else if (p1==p2)
{
printf (" Nobody Wins !");
printf (" Both Of You Entered The Same Letters");
}
else {
printf (" I am Sorry, I do not uderstand.");
printf (" Enter Only Letters : P,S or R");
}
printf(" Do you wish to continue? (y/n) " );
q=getche ();
if (quit=n){
return 0;
}
getch ();
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.