#include <iostream>
#include <string>
#include <sstream>
usingnamespace std;
int main ()
{
string str;
int y = 0;
cout << "Let's play \"Guess the number\". The number is between 0 and 10.\n";
do
{
getline (cin, str);
stringstream (str) >> y;
cout << "You entered " << y;
if (y = 4)
{
cout << ". Correct. Well done!\n";
} else {
cout << ". Incorrect. Try again.\n";
}
} while (y != 4);
system ("PAUSE");
return 0;
}
It seems as if the condition in the loop is ignored. Can someone please tell me what I'm doing wrong?