C++ if statement with else

Description

C++ if statement with else

#include <iostream>
using namespace std;
int main()//  w  w w.j  a v a 2s.c  om
{
   int x;
   cout << "\nEnter a number: ";
   cin >> x;
   if( x > 100 )
      cout << "That number is greater than 100\n";
   else
      cout << "That number is not greater than 100\n";
   return 0;
}
#include <iostream>

using namespace std;

int main(){//from   w  w w.ja v a  2  s .c  om
    int i;

    cout << "Type any number: ";
    cin >> i;

    if (i > 10)
    {
        cout << "It's greater than 10." << endl;
    }
    else
    {
        cout << "It's not greater than 10." << endl;
    }

    return 0;
}



PreviousNext

Related