Quote:
Can't figure out why this won't run.
It even don't compile: you are using undefined symbols
yes
and
no
(you are also using an integer variable where a string is required).
Try:
#include <iostream>
#include <string>
using namespace std;
int main ()
{
string answer;
cout << "Am I the best person on this earth?\n";
cout << "Please enter 'yes' or 'no'.\n";
cin >> answer;
if (answer == "yes")
{
cout << "You are correct, heaven welcomes you!\n";
}
else if (answer == "no")
{
cout << "You are incorrect, the devil will eat your soul!\n";
}
else
{
cout << "Please answer either 'yes' or 'no'.";
}
}