Example 1 : #include using namespace std; int main() { int a; cout << "Input a number. \n"; cin >> a; if (a > 2*(a/2)) cout << "That's odd ! \n"; else cout << "That's even. \n"; return 0; } Example 2 : #include using namespace std; int main() { int a; cout << "What's your age ? \n"; cin >> a; if (a >= 70) cout << "You are a P.G.O.M.L.D.A.D.L.D. \n"; else if (a >= 65) cout << "You are a P.G.O.M.L.D.A.D. \n"; else if (a >= 60) cout << "You are a P.G.O.M.L.D. \n"; else cout << "You are not old yet. \n"; return 0; } Example 3 : calculates the length of a body travelling at a velocity v given its length when it is at rest. #include #include #define c 300 using namespace std; int main() { float restlen, vel, rellen; cout << "Input rest length(in m) and velocity(in 1000 km/s).\n"; cin >> restlen >> vel; if (vel > 300) { cout << "Impossible. A body cannot travel faster than light !\n"; } else { rellen = restlen*sqrt(1 - vel*vel/(c*c)); cout << "Length = " << rellen << " meters.\n"; } return 0; }