by Doogee » Thu Mar 13, 2003 3:42 am
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";
cout << "Please enter your mark for the test today\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;
}