-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbooltest.cpp
More file actions
33 lines (27 loc) · 835 Bytes
/
booltest.cpp
File metadata and controls
33 lines (27 loc) · 835 Bytes
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
#include <iostream>
bool isEqual(int, int);
int main()
{
int x{};
int y{};
std::cout << "Enter an Integer: ";
std::cin >> x;
std::cout << "Enter another one: ";
std::cin >> y;
std::cout << std::boolalpha; // make 0 -> false and other -> true
//std::cin >> std::boolalpha // Only accept true and false for input
// Conversion
//std::cout << std::noboolalpha // make false -> 0 and true -> 1.
//To deactivate the statement above
//std::cin >> std::noboolalpha // Default Setting (NOT necessary)
std::cout <<" Are "<< x << " and " << y << " Equal? " << '\n';
if(isEqual(x,y))
std::cout << "EQUAL!" << std::endl;
else
std::cout << "NOT EQUAL!" << std::endl;
return 0;
}
bool isEqual(int x, int y)
{
return x == y;
}