#include <iostream> using namespace std; int main(void) { int age; cout << "Enter your age: "; cin >> age; if (!(age > 12 && age < 65)) cout << "Admission is free"; else cout << "You have to pay"; return 0; }
2.6.bool | ||||
2.6.1. | bool values | |||
2.6.2. | A bool value can control the if statement | |||
2.6.3. | Outcome of a relational operator is a true/false value | |||
2.6.4. | Variable size of bool | |||
2.6.5. | The || Operator | |||
2.6.6. | The !(Exclamation mark) Operator | |||
2.6.7. | The && Operator (amplifier) | |||
2.6.8. | Output boolean variable as boolean literal or number | |||
2.6.9. | Use bool value to control a while loop | |||
2.6.10. | Logical operators. |