void ShowProgramHeader();
void printInstructions();
void Intro();
int totalValue();
int main()
{
string name;
int totalValue=0;
int playerScore=0, compScore=0;
int getUserGuess, getComputerGuess;
int option;
int choice;
while(1)
{
//Intro to the game and rules
cout <<"Welcome to Rock, Paper, Scissors, Lizard, and Spock! " << endl;
cout <<" " << endl;
cout <<"Rules of the game are as follows: " << endl;
cout <<" " << endl;
cout <<"Scissors cuts Paper, Paper covers Rock, Rock crushes Lizard, Lizard poisons Spock" << endl;
cout <<"Spock smashes Scissors, Scissors decapitates Lizard, Lizard eats Paper, Paper disproves Spock" << endl;
cout <<"Spock vaporizes Rock, and Rock crushes Scissors. " << endl;
cout <<" " << endl;
//Lets the user know game is starting
cout <<"Let the games begin!!!" << endl;
cout <<" " << endl;
//Prompt for username which is used throughout game
cout <<"Please enter your name here: ";
getline(cin,name);
//Game begins
cout <<"Please select a choice of (1-5):" << endl;
cout <<"1 = Rock 2 = Paper 3 = Scissors 4 = Lizard 5 = Spock " << endl;
cout <<"Enter your choice here: ";
cin >> getUserGuess;
if ( getUserGuess == 1 )
{
cout <<"You have chosen: Rock" << endl;
}
else if ( getUserGuess == 2 )
{
cout <<"you have chosen: Paper" << endl;
}
else if ( getUserGuess == 3 )
{
cout <<"You have chosen: Scissors" << endl;
}
else if ( getUserGuess == 4 )
{
cout << "You have chosen: Lizard" << endl;
}
else if ( getUserGuess == 5 )
{
cout << "You have chosen: Spock" << endl;
}
{
{
cout << "You both have chosen wisely, it's a TIE!" << endl;
//Keeps score of wins and losses
playerScore=playerScore+totalValue;
compScore=compScore+totalValue;
cout << name << ", your score is: "<<playerScore<<endl;
cout <<"Computers score is: "<<compScore<<endl;
cin.get();
cout << "Would you like to play again? (Y/N) ";
cin >> option;
if (option == 'n' || option == 'N');
cout <<"Thanks for playing! Come back soon!!!" << endl;
cout <<" " << endl;
cout <<"Your total score was: "<<playerScore+totalValue << endl;
cout <<"Computers total score was: "<<compScore+totalValue << endl;
if (playerScore+totalValue > compScore+totalValue)
cout << "You are the winner!" << endl;
else if (playerScore+totalValue < compScore+totalValue)
cout << "The computer has won!" << endl;
else cout <<"It's a tie." << endl;
break;
}
//Keeps score of wins and losses
playerScore==playerScore+totalValue;
compScore==compScore+totalValue;
cout << name << ", your score is: "<<playerScore+totalValue<<endl;
cout <<"Computers score is: "<<compScore+totalValue<<endl;
cout << "Would you like to play again? (Y/N) ";
cin >> option;
if (option == 'n' || option == 'N');
cout <<"Thanks for playing! Come back soon!!!" << endl;
cout <<" " << endl;
cout <<"Your total score was: "<<playerScore+totalValue << endl;
cout <<"Computers total score was: "<<compScore+totalValue << endl;
if (playerScore+totalValue > compScore+totalValue)
cout << "You are the winner!" << endl;
else if (playerScore+totalValue < compScore+totalValue)
cout << "The computer has won!" << endl;
{
cout << "I'm sorry " << name << ", but you have LOST, try again!" << endl;
compScore++;
}
{
//Keeps score of wins and losses
playerScore=playerScore+totalValue;
compScore=compScore+totalValue;
cout << name << ", your score is: "<<playerScore+totalValue << endl;
cout <<"Computers score is: "<<compScore+totalValue << endl;
cout << "Would you like to play again? (Y/N) ";
cin >> option;
if (option == 'n' || option == 'N');
cout <<"Thanks for playing! Come back soon!!!" << endl;
cout <<" " << endl;
cout <<"Your total score was: "<<playerScore+totalValue << endl;
cout <<"Computers total score was: "<<compScore+totalValue << endl;
}
{
if (playerScore+totalValue > compScore+totalValue)
cout << "You are the winner!" << endl;
else if (playerScore+totalValue < compScore+totalValue)
cout << "The computer has won!" << endl;
if (option == 'n' || option == 'N');
remove the semicolon, and put a bracket so that all statements that should be executed if the user choose 'n' or 'N' will be executed