Problem with Logical OR in Dev-C++

I keep trying to create a game code in C++. Just a simple dice game, nothing big or bad. Now, I've got the entire code working solidly, except for one thing. When the code asks if the player would like to play again, it treats the response as an affirmative, whether it is or not, so it ALWAYS replays the game. What is wrong? Code is below.

//
// Simple Dice Game- Output two random values between 1 and 6 to simulate dice
// and add an opponent
// Take 2
//
#include <iostream>
#include <cmath>
#include <ctime>
using namespace std;
int main () {
string (replayResponse);
do {
//Initialize random seed
srand(time(NULL));

//Display random integer between 1 and 6 two times
int a;
a = rand()% 6+1;
int b;
b = rand()% 6+1;
int c;
c = a+b;
cout << a << endl;
cout << b << endl;
cout << "Your score is " << c << endl;

//Display opponent's two dice rolls
int d;
d = rand()% 6+1;
int e;
e = rand()% 6+1;
int f;
f = d+e;
cout << d << endl;
cout << e << endl;
cout << "Your opponent's score is " << f << endl;

if (c>f) {
cout << "You win!" << endl;}
if (c<f) {
cout << "You didn't win..." << endl;}
if (c==f) {
cout << "It's a tie!" << endl;}

//Ask player if he/she would like to play again and run program again if
//response is positive
cout << "Would you like to play again?" << endl;
cin >> replayResponse;
}

while (replayResponse != "No"||"no");
system("PAUSE");
return 0;
}
change this;
 
    while (replayResponse != "No"||"no");
to test each condition in full like this:
 
    while (replayResponse != "No"  && replayResponse != "no");
note that the two conditions need to be combined with a logical and since the test is for not-equal-to.

An alternative would be:
 
    while ( !(replayResponse == "No"  || replayResponse == "no"));

while (replayResponse != "No"||"no"); is interpreted as
while ( (replayResponse != "No") or "no"); which is true as an string literal does not evaluate to NULL.

You need to write while(replayResponse != "No" and replayResponse != "no");
I see my mistake now. Thank you for your excellent answers!
Topic archived. No new replies allowed.