C++ int type Compare variables input from keyboard

Description

C++ int type Compare variables input from keyboard

#include <cstdio>
#include <cstdlib>
#include <iostream>
using namespace std;

int main(int nNumberofArgs, char* pszArgs[])
{
    // set output format for bool variables to true and false instead of 1 and 0
    cout.setf(cout.boolalpha);/*from w  ww . java2 s  . c  o  m*/

    int nArg1;
    cout << "Input value 1: ";
    cin >> nArg1;

    int nArg2;
    cout << "Input value 2: ";
    cin >> nArg2;

    bool b;
    b = nArg1 == nArg2;

    cout << "The statement, " << nArg1
         << " equals "        << nArg2
         << " is "            << b
         << endl;

    return 0;
}



PreviousNext

Related