C++ Project – Rock Paper Scissor Game
Master C++ with Real-time Projects and Kickstart Your Career Start Now!!
Program 1
//Rock Paper Scissors Game
#include<stdio.h>
#include<conio.h>
#include<iostream>
#include<time.h>
#define clrscr() system("cls")
using namespace std;
int main()
{
clrscr();
int compchoice,userchoice;
while(1)
{
compchoice=rand()%3+1;
cout<<"---------Rock Paper Scissors Game------------";
cout<<"\n 1. Rock \n 2. Paper \n 3. Scissors";
cout<<"\n-----------------------------------------------";
cout<<"\nEnter users choice";
cin>>userchoice;
if(userchoice==compchoice)
cout<<"Its a tie";
else if((userchoice==1 && compchoice==3) || (userchoice==2 && compchoice==1) || (userchoice==3 && compchoice==2))
cout<<"\n Congrats you win the game";
else
cout<<"\n Opps you lose the game";
cout<<"\n User Choice: "<<userchoice;
cout<<"\n Computer Choice: "<<compchoice;
cout<<"\n You want to play again !(1-Yes , 0 - No)";
int choice;
cin>>choice;
if(choice!=1)
break;
}
cout<<"Thanks for playing... Bye Bye";
return 0;
}
Did you know we work 24x7 to provide you best tutorials
Please encourage us - write a review on Google

