Read an integer and check its value in if statement - C++ Statement

C++ examples for Statement:if

Description

Read an integer and check its value in if statement

Demo Code

#include <iostream>
using namespace std;
int main()//from   w  w  w.  ja  v  a2 s  . c  om
{
   int num;
   cout << "Enter a number: ";
   cin  >> num;
   if (num == 5)
      cout << "Bingo!\n";
   else
      cout << "Bongo!\n";
   return 0;
}

Result


Related Tutorials