-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathComparingInts.cpp
More file actions
53 lines (40 loc) · 1.32 KB
/
Copy pathComparingInts.cpp
File metadata and controls
53 lines (40 loc) · 1.32 KB
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
42
43
44
45
46
47
48
49
50
51
52
53
//Author Angel Zaldivar
//Goal Read and Compare Two Integers
#include <iostream>
using namespace std;
int main() {
//Variable Declerations
int value_a, value_b;
//input
cout << "Enter a postive EVEN integer: ";
cin >> value_a;
//process - output
//inside the loop
while (value_a % 2 == 1 || value_a < 0)
{
cout << "ERROR - Expecting a POSTIVE EVEN number - Please try again.\n";
cout << "\nEnter a postive EVEN integer: ";
cin >> value_a;
}
//outside the loop
cout << ("---------------------------------------------\n");
cout << "\nEnter a positive ODD integer: ";
cin >> value_b;
//inside the loop
while (value_b % 2 == 0 || value_b < 0)
{
cout << "ERROR - Expecting a POSTIVE ODD number - Please try again.\n";
cout << "\nEnter a postive ODD integer: ";
cin >> value_b;
}
//outside the loop
if (value_a > value_b)
{
cout << ("---------------------------------------------\n");
cout << "\nThe first number (" << value_a << ") is larger or equal than the second (" << value_b << ")";
}
else {
cout << ("---------------------------------------------\n");
cout << "\nThe second number (" << value_b << ") is larger or equal than the first (" << value_a;
}
}