An if statement without an else clause - C++ Statement

C++ examples for Statement:if

Description

An if statement without an else clause

Demo Code

#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); 
}

Result


Related Tutorials