C++ if statement prints whether or not the number is greater than zero
#include <iostream> using namespace std; int main()/*from w w w. j av a 2 s . co m*/ { int num; cout << "What is your number? "; cin >> num; // Get the user's number. if (num > 0) { cout << "More than 0\n"; } else { cout << "Less or equal to 0\n"; } // No matter what the number was, the following executes. cout << "\n\nThanks for your time!\n"; return 0; }