So , i had to make an rock paper scissors game . After lot of hard work and struggle ,I completed it but my professor rejected it since I didnot add option where it says "Would you like to play again .Y/N " . I have tried everything for hours and hours but cant figure out as the code has too many brackets ! Any help would be appreciated. THank you. . Here is my code
#include <iostream>
#include <ctime>
#include <cstdlib>
using namespace std;
// for displaying the outputs to the user; passing string to functions
void user_win()
{
cout << "\n Congratulations! You beat computer.\n" << endl << endl;
void user_draw()
{
cout << " \nIts a draw ! Unbelieveable.Please play again\n " << endl;
}
int main()
{
{
srand(time(NULL)); // for generating random the time is unsigned
int user_choice;
int comp_choice;
// Displaying the title and getting the user choice
cout << "\n ****~~ Rock , Paper , Scissors Game ~~**** \n ";
cout << " Good luck\n\n ";
cout << "Please enter 1 for rock , 2 for paper and 3 for scissors:";
cin >> user_choice;
comp_choice = (rand() % 3) + 1; //equation for generating random number
//for conforming user what he choosed
if (user_choice == 1)
{
cout << "\nYou choosed Rock " << endl;
}
else if (user_choice == 2)
cout << "\nYou choosed Paper " << endl;
else if (user_choice == 3)
{
cout << "\nYou choosed Scissors " << endl;
}
else
{ // Input Validation
cout << "\nInvalid entry ! Please enter 1 for rock, 2 for paper and 3 for scissors:";
cin >> user_choice;
}