For my class, I am creating a rock paper scissors game. My code is not all the way done, but I am stuck on a certain part of the process. For some reason, I am getting errors on the "==" in:
while (true)
{
human = humanChoice();
computer = computerChoice();
if (human == 'Q' || human == 'q') break;
if (human == 'R' || human == 'r')
}
It tells me that no operator was found for the "==". I've used this code block in many other programs but it just isn't working this game.
My full code is:
#include <iostream>
using namespace std;
char computerChoice()
{
char rock = 'R';
return rock;
}
char humanChoice()
{
char choice = "";
while(true)
{
cout << "Choose(Rock,Paper,Scissors,or Quit): ";
cin >> choice;
cin.ignore(1000, 10);
if (choice == "Q" || "q") break;
if (choice == "R" || choice == "r") break;
if (choice == "S" || choice == "s") break;
if (choice == "P" || choice == 'p') break;
}
return choice;
}
void printScore()
{
}
int main()
{
// initialize the computer's random number generator
srand(time(0));
// declare variables
string human;
string computer;
// start loop
while (true)
{
human = humanChoice();
computer = computerChoice();
if (human == 'Q' || human == 'q') break;
if (human == 'R' || human == 'r')
}
// determine computer's choice
// prompt for, and read, the human's choice
// if human wants to quit, break out of loop
// print results
// end loop
// end program
cout << "Press ENTER to continue..." << endl;
cin.get();
return 0;
}