Cpp if and code example
Example 1: if not c++
#include <iostream>
using namespace std;
bool state = false;
if (state != true) { //Boolean is false.
cout << "No";
} else { //Boolean is true
cout << "Yes";
}
Example 2: if c++
int x = 20;
int y = 18;
if (x > y) {
cout << "x is greater than y";
}
Example 3: c++ how to do else if statements
if (variable) {
variable is true
}