C++ if Statement

#include <iostream>

int main() {
    int num = 10;

    if (num > 0) {
        std::cout << "The number is positive." << std::endl;
    } else if (num == 0) {
        std::cout << "The number is zero." << std::endl;
    } else {
        std::cout << "The number is negative." << std::endl;
    }

    return 0;
}
  1. Include the iostream header file.
  2. Define the main function.
  3. Declare an integer variable num and initialize it with the value 10.
  4. Begin the if statement with the condition num > 0.
  5. If the condition is true, execute the block inside the curly braces, printing "The number is positive."
  6. If the condition in the if statement is false, move to the else if statement with the condition num == 0.
  7. If the condition in the else if statement is true, execute the corresponding block, printing "The number is zero."
  8. If both the conditions in the if and else if statements are false, execute the block inside the else statement, printing "The number is negative."
  9. End the program by returning 0 from the main function.