07-if-else

AdSense Placeholder (Header)
C++ Tutorials Beginners

C++ If-Else: Branching Logic

Controlling your program with logical branches.

What is If-Else?

Decision making structures require the programmer to specify one or more conditions to be evaluated or tested by the program. In C++, if-else is the most basic and powerful tool for this.

if (age > 18) {
    cout << "You are an adult.";
} else {
    cout << "You are a minor.";
}