#include <iostream>
#include <string>
usingnamespace std;
int main(){
bool answer;
cout << "Is Dutch and Againtry a troll on the C++ forum ?" << endl;
cin >> answer;
if(answer==true)
{
cout <<"You damn right they are a troll" << endl;
}
else
{
cout <<"Its highly questionable" << endl;
}
return 0;
}
@cblack618
You have embarrassed me in front of my piers. I am shattered. I didn't ask for any of this. All I have ever done is go out of my way to help you. And what do I get? Nothing but ostracism, derision and the meanest of outcomes from a C++ decision structure.
Bjarne and Cubbi, not to forget the Fatuous Flying Nun JL Booger, will turn in their graves after seeing how their work has been turned to evil.
You've seen all my other threads where i've sought help with assignments.
That's debatable. It really looks like you're trying to get the code done for you, I have seen very little progress on your part in trying to figure out the problems. And this thread is a real indication of an attitude problem on your part.
Well, you've certainly broken me down by stepping on me. I'm totally shattered by being discredited before my piers, totally dwharfed by the experience, pushed back to being a BEGGINNERR!
#include <iostream>
#include <string>
usingnamespace std;
int main()
{
bool answer;
cout << "Is Dutch and Againtry a troll on the C++ forum ? "; // <--- Leaving off the "endl" puts the "cin" on the same line.
cin >> boolalpha >> answer;
if(answer) // <--- This is all you need.
{
cout <<"You damn right they are a troll" << endl;
}
else
{
cout <<"Its highly questionable" << endl;
}
return 0;
}
You are trying to enter a string when you need a number. The "boolalpha" will convert a number to a word or a word to a number.