#include <iostream>
#include <ctime>
#include <conio.h>
using namespace std;
bool player_won (int player, int computer)
{
switch (player)
{
case 1:
if (computer==2)
return false;
else return true;
case 2:
if (computer==3)
return false;
else return true;
case 3:
if (computer==1)
return false;
else return true;
}
}
main ()
{
cout<<"Rock, paper scissors by TheMaster999"<<endl;
srand (time(NULL));
while (true)
{
int computer=rand()%3+1;
int player;
cout<<"If u choose rock type 1, if u choose paper type 2, if u choose scissors type 3"<<endl;
cin>>player;
if (player==computer)
cout<<"Draw, play again"<<endl;
else if (player_won(player,computer))
{
cout<<"Congratulations, you won!"<<endl;
break;
}
else
{
cout<<"You lost :("<<endl;
break;
}
}
cout<<"Thank you, for playing my game"<<endl;
getch();
return 0;
}