A copy of Smac89's code. Interesting.
To the eye it seems faultless, however if it's giving you problems you could do some serious inception if statements(I think, more conventionally named, 'Nested'?).
cin >> answer;
if ((random_number == random_number2)
if(answer == "yes")
cout << "You are correct!\n";
cout << "You are incorrect!\n";
// I'm sure you get the idea.
Also if your using Visual C++ Express, as I guess I'd say your using windows. so change,
EDIT: Had to change from 'else if' to 'else'
I'd say it is easier to compare an integer than a string, instead of the user typing 'yes' . So try using 0 as yes and 1 as no.
Or ( a more drastic approach ) would be designing your own comparison algorithm. Easiest way to compare 2 entities is using XOR, the ^ operator.
if(random_number ^ random_number2 = 0)
cout << "Numbers are the same!\n";
cout << "Numbers are not equal!\n";