#include <iostream>
using namespace std;
int main() {
bool prop;//creates boolean variable named prop
prop = (5>1); //assigns prop to 1. This is because 5>1 is a true statement and true is represented with 1 in c++. False if represented by 0.
cout<<"prop is "<<prop<<endl; //outputs string "prop is " followed by 1
prop = (1>5); //assigns prop to 0
cout<<"prop is "<<prop<<endl; //outputs string "prop is " followed by 0
prop = (1 != 5); //assigns prop to 1
cout << "prop is " <<prop<<endl; //outputs string "prop is " followed by 1
return 0; //exits program
}
Output:
[cms-opendata@localhost src]$ ./a.out
prop is 1
prop is 0
prop is 1