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

Description

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

#include <iostream>
using namespace std;
int main()//from   ww w.j  a  va 2 s .com
{
   int num;
   cout << "Enter a number: ";
   cin  >> num;
   if (num == 5)
      cout << "Bingo!\n";
   else
      cout << "Bongo!\n";
   return 0;
}



PreviousNext

Related