C++ examples for Statement:if
An if statement without an else clause
#include <cstdlib> #include <iostream> using namespace std; int main(int argc, char *argv []) { cout << "Please input a number greater than or equal to 0: "; int aNumber; /*w ww .ja va 2 s .c om*/ cin >> aNumber; if (aNumber >= 0) { cout << "Very good." << endl; } return (0); }