Bool

Can someone help me fix this code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
  #include <iostream>
#include <string>

using namespace 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;

}
Perhaps it would help if you described the problem?

What exactly did you provide for your input?

I put true, of course
You don't need #include <string>, nor return 0, and your indentation is all over the place.
Sorry about indentation. Using a mobile IDE
I put true, of course

Well then, there is your problem.

You're also missing another part of the equation: "Is cblack618 a troll?". Also seems like a good possibility.

I’m not a troll tho
@dutch is blunt sometimes, but not a troll.
Last edited on
Definitely a troll
jesus @cblack618, that sort of put down really hurts. What sort of a person are you to be so mean? Have you no shame?
Have you no shame in trolling and being mean to someone legititmately trying to get help with their homework on a forum and trying to learn ?
But where in this topic is there anyone that is legitimately trying to get help?

Don't play coy. You've seen all my other threads where i've sought help with assignments.
@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.

Shame on you!
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.

So to my ignore list you go, good luck.

how can i figure something out I DO NOT KNOW. I've stated a thousand times. I am a beginner. I am willing to learn but i do not know.

I need things broken down into steps. People giving me a genric assestment of what i need to do does not help
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!
Hello cblack618,

To answer your question:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#include <iostream>
#include <string>

using namespace 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.

Andy

Thanks Andy ! Appreciate it
Hello cblack618,

You are welcome.

Sorry for the delay I lost track of this for awhile.

Andy
Topic archived. No new replies allowed.