1. ## Problem with Boolean.

Okay, well, I copied the script from the tutorial on the site (the enter your age tutorial one), and I added more phrases. The problem was that if you entered, "2", as your age, you would get all the answers for the other ages. Let me post the code so you know my problem.
Code:
```#include <iostream>

using namespace std;

int main()
{
int age;

cin>> age;
cin.ignore();
if ( age <= 25 ) {
cout<<"You are pretty young!\n";
}
if ( age <= 50 ) {
cout<<"You are middle aged\n";
}
if ( age <= 100 ) {
cout<<"You are old\n";
}
else if ( age <= 125 ) {
cout<<"You are really old\n";
}
else {
cout<<"Stop lying you moron and tell me your age\n";
}
cin.get();
}```

That was what I originally changed, until this...

Code:
```#include <iostream>

using namespace std;

int main()
{
int age;

cin>> age;
cin.ignore();
if ( age <= 25 ) {
cout<<"You are pretty young!\n";
}
if ( age <= 50 && >= 26 ) {
cout<<"You are middle aged\n";
}
if ( age <= 100 && >= 51 ) {
cout<<"You are old\n";
}
else if ( age <= 125 && >= 101 ) {
cout<<"You are really old\n";
}
else {
cout<<"Stop lying you moron and tell me your age\n";
}
cin.get();
}```
The problem is I don't know boolean, or how to fix this problem so please help me, a lonely n00b, out.

2. Code:
`  if ( age <= 50 && age >= 26 ) {`
You're pretty close; just add age to each check.

3. Oh dude, thanks. Now let me try it out.

EDIT: Awesome, it works. Thanks man.

4. Either that or you are missing a couple else's:

Code:
```#include <iostream>

using namespace std;

int main()
{
int age;

cin>> age;
cin.ignore();
if ( age <= 25 ) {
cout<<"You are pretty young!\n";
}
else if ( age <= 50 ) {
cout<<"You are middle aged\n";
}
else if ( age <= 100 ) {
cout<<"You are old\n";
}
else if ( age <= 125 ) {
cout<<"You are really old\n";
}
else {
cout<<"Stop lying you moron and tell me your age\n";
}
cin.get();
}```

5. Oh yeah, thanks dude. Also, how would I make it say random things? Well, not random, but randomly pick a phrase for that specific input. So like, if they say a number from 50 to 100, it'll pick a phrase that's meant to be said only for 50 to 100.

6. Originally Posted by Asbestos
Also, how would I make it say random things? Well, not random, but randomly pick a phrase for that specific input. So like, if they say a number from 50 to 100, it'll pick a phrase that's meant to be said only for 50 to 100.

You would need an array or other somesuch container which held the strings that you wished to select from. Then you would need to use the srand and rand functions to generate a random number from which you would be able to pick one of the strings to output.

7. Oh thanks. Now let me ask my god google for some tuts on that .

8. Originally Posted by Asbestos
Oh thanks. Now let me ask my god google for some tuts on that .
Or you could just look at the tutorial. The main Cprogramming website is available to look at and learn from.

9. How did I miss that? Oh well, thanks.

10. You're welcome!

Sorry if I sounded grumpy. I was in a bad mood, but then I played with my Hello Kitty dolls... I...I mean ate a bowl of ice cream, yeah, that was it!

\/\/
fuh
/\/\

11. No offense taken, and Hello Kitt... Ice Cream is the best thing ever made. Yes, ice cream.

12. "Hello Kitty"?

*edit*
Hmm... Rather peculiar.