Program For The Game Rock,: Paper and Scissor
Program For The Game Rock,: Paper and Scissor
#include<iostream.h>
#include<conio.h>
#include<stdio.h>
#include<string.h>
Void main()
{
string input;
cin>>input;
cout<< “the player chose”<<input<<endl;
string choices[3]={“rock”, “paper”, “scissor”};
string chosen=choices[rand()%3];
cout<< “The Computer Chose”<<chosen<<endl;
cout<< “RESULTS”<<ENDL;
string tie= “Tie!”;
string lost= “You Lost!”;
string won= “You Won!”;
if(input==chosen)
cout<<tie;
else if( input== “rock” && chosen== “scissor”)
cout<<won;
else if ( inpit== “rock” && chosen== “paper”)
cout<<lost;
else if( input== “paper” && chosen== “rock”)
cout<<won;
else if(input== “paper” && chosen== “scissor”)
cout<<lost;
else if(input== “scissors”&&chosen== “paper”)
cout<<won;
else if( input== “scissors”&& chosen== “rock”)
cout<<lost;
else
cout<< “\nInvalid Input!!!!”<<endl<< “Plz Try Again”
getch();}