Help with Bool (rock paper scissor game)

I am having trouble getting the bool to switch so i can change turns. It just keeps telling Player one it is his turn and to input an answer.

#include <iostream>

using namespace std;

int main()
{
const char ROCK= 'R';
const char SCISSORS= 'S' ;
const char PAPER= 'P';

bool player1 = true;
char p1choice = '1';
char p2choice = '2';
char quit = 'a';

cout << "Welcome to a dope game of Rock, Paper Scissors. Player 1 will go first and type R, S, or P for Rock, Scissors, respectivley" << endl;
cout << "Then Player 2 will have an turn, make sure player two does not watch player ones choice. Press q or Q to end the game. Enjoy!" << endl;
cout << " --- LETS PLAY!---" << endl;

do {
if(player1 = true) {
cout << "Player one, it is your turn, Rock(R), Paper(P), or Scissors (S)?" << endl;
cin >> p1choice;
player1 = false;


} else {
cout << "Player two, it is your turn, Rock(R), Paper(P), or Scissors (S)?" << endl;
cin >> p2choice;
player1 = true;
}

if (p1choice == 'P' && p2choice == 'R') {
cout << "player2 won";

} else
{}







}while( quit != 'q' && quit != 'Q' );

}


if(player1 = true) {

should be...

if(player1 == true) {
If you do this:
if (player1 = true ) {}

You are not testing player1 for equality, you are using the assignment operator "=" to assign a value.

The correct way is this, as the above comment states
if (player1 == true ) {}

The reason is that "==" tests the lvalue player1 for equality, and does NOT modify the value. Thus, it simply returns a boolean depending on whether the statement is true or not.
Topic archived. No new replies allowed.