plZ how can we make a program in c++ enum type for all possible results rock paper scissors and its out put would be | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
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

7th Oct 2017, 7:40 AM
Muhammad Usama
Muhammad Usama - avatar
2 Answers
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)
11th Nov 2017, 1:39 AM
Kemi
Kemi - avatar
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😜😜😎😎
26th Dec 2017, 7:19 PM
Muhammad Usama
Muhammad Usama - avatar