ROCK PAPER SCISSORS USING C.PDF 01
ROCK PAPER SCISSORS USING C.PDF 01
TEAM:
MADHUSUDANA (N-39)
LAVANYA G (N-33)
PADMINI S (N-54)
INTRODUCTION:-
We would like to extend my gratitude to the principal Sir “Dr.Sanjay jain” and
vice principal sir “Dr.B.Narasimha murthy” and also our HODs
“Dr.Raveesha K H” and “Dr.Fazlur Rahaman” for providing us with all the
facility that was required for this project we would like to express our special
thanks of gratitude to our beloved teachers and seniors for their able
guidance and support in completing our project.
GROUP MEMBERS:
• MADHUSUDANA(N-39)
• LAVANYA G(N-33)
• PADMINI S(N-54)
DECLARATION BY THE CANDIDATES
• We hereby declare that that the project entitled “ROCK PAPER
SCISSORS using C programming” is an outcome of our own efforts
under the guidance of our seniors.
• This project is submitted to CMR Institute of technology .
PROGRAMME CODE :-
#include <stdio.h>
#include <conio.h>
int you, computer; // GLOBAL DECLARATION
int
menu ()
{
int ch;
printf ("\n1.select ROCK ");
printf ("\n2.select PAPER ");
printf ("\n3.select SCISSOR ");
printf ("\n4.EXIT");
printf ("\n ENTER YOUR CHOICE : ");
scanf ("%d", &ch);
return (ch);
}
void
setup ()
{
label:
computer = rand () % 4;
if (computer == 0)
goto label;
you = menu ();
}
void
makelogic ()
{
switch (you)
{
case 1: //YOU = ROCK ,COMPUTER =ROCK
if (computer == 1)
{
printf ("\n GAME DRAW ");
printf ("\n you=rock \n computer = rock");
}
else if (computer == 2)
{ // you = rock ,computer = paper
printf ("\n you = rock\n computer = paper ");
}
else //you=rock ,computer = scissor
{
printf ("\nYOU WON");
printf ("\n you = rock \n computer = scissor");
}
break;
case 2: //YOU = paper ,COMPUTER =ROCK
if (computer == 1)
{
printf ("\n YOU WON ");
printf ("\n you = paper \n computer = rock");
}
else if (computer == 2) // you=paper ,computer =paper
{
printf ("\n GAME DRAW ");
printf ("\n you = paper \n computer = paper ");
}
else //you=paper,computer = scissor
{
printf ("\n COMPUTER WON ");
printf ("\n you = paper \n computer = scissor");
}
break;
case 3:
if (computer == 1) // you=scissor ,computer =paper
{
printf ("\n COMPUTER WON ");
printf ("\n you = paper \n computer = rock");
}
else if (computer == 2) // you=scissor ,computer =paper
{
printf ("\n YOU WON ");
printf ("\n you = paper\n computer = paper");
}
else //you=scissor ,computer = scissor
{
printf ("\n DRAW ");
printf ("\n you = paper \n computer =scissor");
}
break;
case 4:
break;
default:
{
printf ("\n invalid user CHOICE ;");
}
}
}
int
main ()
{
while (1)
{
system ("cls");
setup ();
makelogic ();
getch ();
}
return 0;
}
OUTPUT:
Conclusion :-
❖ This concludes the C programming lesson.
❖ We hope this will be entertaining and enjoyable playing with
it.
******Thank you*******