1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
//
//Booltest app, Compare variables input from the keyboard and store
//the results off into a logical variable.
//
#include <cstdio>
#include <cstdlib>
#include <iostream>
using namespace std;
int main(int nNumberofArgs, char* pszArgs[])
{
cout << "This program examines two numbers and tells you if they're the same.";
// Set output format for bool variables
//to true and false instead of 1 and 0
cout.setf(cout.boolalpha);
// initialize two arguements
int nArg1;
cout << "\nInput 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;
// Wait until user is ready before terminating the program
// to allow user to see the results.
system("PAUSE");
return 0;
}
|