Hi! So, I'm a beginner, so I don't have the ability to identify the mistake I made. Can someone please tell me what I did wrong(Please use beginner language)?
In the future could you please describe what is wrong? As in what the program is doing currently and also what you want the program to do that it is not doing currently. Just saying find the problem is not usually going to get a good response on here.
Your problem is probably on lines 10 and 20, where you have used the assignment operator (single =) instead of the comparison operator (double ==)
metulburr,
Thanks! I didn't know about the = and == meanings.
kevinkjt2000,
Thank you! I'll make sure to do so next time. And thanks for the answer to my mistakes!
Oh, and when I build/run it, and I get my answer, instead of saying what it's supposed to say(The answer is:(Whatever the answer is)), it says "e answer is:" Anyone know?
cout << "The answer is:" + (answer);
should be cout << "The answer is:" << answer;.
In general, "+" won't work for concatenating something other than a std::string to a string literal (or C string in general).
So "Hello " + "world!" will not give you "Hello world!" (actually, it doesn't even compile for me), nor will "Hello" + 15 give you "Hello15".
(For the former, you can use std::string("Hello ") + "world!" to get what you want, and for the latter, you'll have to do something like "Hello" + std::to_string(15). But since you're just sending everything to cout, you don't even need to do any of that -- just use the << operator: std::cout << "Hello " << "world" << 15;.)