Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

C#

haakon Guttormsen
haakon Guttormsen
2,157 Points

Getting error running a C++ program. I know that c# is`nt the right topic:)

Geting error in this program. Cant get the multiple if-statements to work.

int age;
cout<< "Please enter the age of the recipient (followed by 'enter') \n";
cin>> age;
cout<< "I heard you just had birthday and you just got " << age << " years old!\n";
if (age>=110) && (age<=0){
    cout<< "you are kidding!\n";
}
haakon Guttormsen
haakon Guttormsen
2,157 Points

I got the program to work now. Had to add some parenthesis. But the program still does`nt add the cout inside the if-statement when I type in values that are true.. :/

1 Answer

Stuart Wright
Stuart Wright
41,119 Points

Looks like you’re saying greater than or equal to 110 and less than or equal to 0. This will never evaluate to true.