So i have this as my code for my rock paper scissors game but apparently it need to also keep score? I am very new at this, can anyone help me out?
#include <iostream>
using namespace std;
int main()
{
char player1;
char player2;
char answer;
cout << "Enter R for rock, P for paper, or S for scissors and press enter\n";
cin >> player1;
cout << "Enter R for rock, P for paper, or S for scissors and press enter\n";
cin >> player2;
do
{
if (player1 == player2)
cout << "It's a tie!";
else
{
if (player1 == 'p' || 'P' && player2 == 's' || 'S')
cout << "Player 2 wins because scissors beats paper!";
else if (player1 == 'p' || 'P' && player2 == 'r' || 'R')
cout << "Player 1 wins because paper beats rock!";
else if (player1 == 's' || 'S' && player2 == 'r' || 'R')
cout << "Player 2 wins because rock beats scissors!";
else if (player1 == 's' || 'S' && player2 == 'p' || 'P')
cout << "Player 1 wins because scissors beats paper!";
else if (player1 == 'r' || 'R' && player2 == 'p' || 'P')
cout << "player 2 wins because paper beats rock!";
else if (player1 == 'r' || 'R' && player2 == 's' || 'S')
cout << "Player 1 wins because rock beats scissors!";
else if (player1 != 'p' || 'P' || 'r' || 'R' || 's' || 'S')
cout << "error, player 1, you must enter either R, P, or S";
else if (player2 != 'p' || 'P' || 'r' || 'R' || 's' || 'S')
cout << "error, player 2, you must enter either R, P, or S";
}
cout << "Do you want to play again? Enter y or n and press enter";
cin >> answer;
} while (answer == 'y' || 'Y');
cout << "Game over.";
Save the file to the hard drive and read it's contents on the programs initialization (before your do while statement). That way you can save and load previous scores.