// If Else Example #1 C++ Code from CodingMagic.com // Copyright 2008 by Pierre Dufilie IV #include // Include the system() function so we can pause the program #include // Include the printf() function so we can print to the screen int main(void) { // The main function - this is where the program begins running if (1 == 1) { // Test to see if 1 is equal to 1 (it should be ...). If so, then run the following code. printf("1 is equal to 1 after all!\n"); // Use printf to display "1 is equal to 1 ..." } else { // If the above if statement's condition isn't met, i.e. if 1 isn't equal to 1, then we run the following code. This should never happen because 1 is always equal to 1. printf("1 isn't equal to 1? What!?\n"); // Use printf to display "1 isn't equal to 1 ..." } system("PAUSE"); // Run a system command via system() function to pause execution return 0; // Represents the return value of the program (EXIT_SUCCESS) }