## Boolean Stuff

Discuss Programming
Doogee Posts: 261
Joined: Fri Jan 10, 2003 1:40 am

### Boolean Stuff

Hey, im trying to learn the boolean cpp stuff but cant get a simple program to compile.

Code: Select all

``````#include <iostream.h>

int main()

{
int mark;
cout << "If Statement Examlple\n\n\n\n";
cin >> mark; // asks user input, sets variable as "mark"
if(mark == 20) // if the mark is exactly equal to 20 do:
{
cout << "Wow! Full marks, thats great!\n";
return 0;
}
if(mark > 20) // if mark is more than 20 do:
{
cout << "Thats Impossible, the test was out of 20, liar\n";
return 0;
}
if(mark > 15 && < 20) // if mark is above 15 and below 20 do:
{
cout << "Thats a great mark, top effort!\n";
return 0;
}
if(mark > 10 && < 15) // if mark is above 10 and below 15 do:
{
cout << "Comeon, better effort next time matey\n";
return 0;
}
if(mark < 10) // if mark is below 10 do:
{
cout << "Pretty average\n";
return 0;
}
return 0;
}``````

Void Main Posts: 5716
Joined: Wed Jan 08, 2003 5:24 am
Location: Tuxville, USA
Contact:

Code: Select all

``````#include <iostream.h>

int main()
{
int mark;

cout << "If Statement Examlple\n\n\n\n";
cin >> mark; // asks user input, sets variable as "mark"

if(mark == 20) {
cout << "Wow! Full marks, thats great!\n";
return 0;
}

if(mark > 20) {
cout << "Thats Impossible, the test was out of 20, liar\n";
return 0;
}

if(mark > 15 && mark < 20) {
cout << "Thats a great mark, top effort!\n";
return 0;
}

if(mark > 10 && mark < 15) {
cout << "Comeon, better effort next time matey\n";
return 0;
}

if(mark < 10) {
cout << "Pretty average\n";
return 0;
}

return 0;

}
``````

Doogee 