Write your question here.
Whenever I put in a number other than 42 it doesn't input the number after the sentence like I want it to. For example, if you put in 12 I want it to say "Wrong! The answer to life, the universe, and everything is not 12" I don't understand why it's not working.
#include <iostream>
usingnamespace std;
int main() {
int hitchhikers;
hitchhikers = 40;
int guide;
guide = 2;
int the_answer;
the_answer = hitchhikers + guide;
int what_is;
cout << "What is the answer to life, the universe, and everything?" << endl;
cin >> what_is;
if (what_is == 42) {
cout << "The answer to life, the universe, and everything is 42. What does 42 mean though?" << endl;
}
else {
cout << "Wrong! The answer to life, the universe, and everything is not" + (int)what_is << endl;
}
system("pause");
return 0;
}