A simple if-else statement - C++ Statement

C++ examples for Statement:if

Description

A simple if-else statement

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; 

    cin >> aNumber; /*from w ww.j a v  a  2  s.  com*/

    if (aNumber >= 0) 
    { 
        cout << "Very good." << endl; 
    } 
    else 
    { 
    cout << "Not very good." << endl; 
    } 

  
    return (0); 
}

Result


Related Tutorials