0
plZ how can we make a program in c++ enum type for all possible results rock paper scissors and its out put would be
Choose rock(0),paper(1),scissor(2) player #1 : 1 player #2 : 1 you tied
2 Antworten
0
you'll just have to write some if statements:
int player1, player2;
cin >> player1 >> player2;
if (player1 == player2)
{
cout << "tie";
}
else if (player2 > player1)
{
if (player1 == player2 - 1)
{
cout << "player 2 wins";
}
else
{
cout << "player 1 wins";
}
}
else
{
if (player2 == player1 - 1)
{
cout << "player 1 wins";
}
else
{
cout << "player 2 wins";
}
}
the program works if the values are 0,1 and 2, as you've described in the description. You'll have to add your list of includes and libraries used (using namespace std, in this case)
0
yeah really apreciate it bro but it was for journal and i did it thanks god but yeah i might need help in file handling and other pro stuff😜😜😎😎