forked from wadehuber/codeexamples
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathboolean.cpp
More file actions
66 lines (53 loc) · 1.24 KB
/
Copy pathboolean.cpp
File metadata and controls
66 lines (53 loc) · 1.24 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
54
55
56
57
58
59
60
61
62
63
64
65
66
#include<iostream>
using namespace std;
bool bigger (int a, int b) {
return (a > b);
}
int main() {
bool check = true;
bool finished { false };
bool myBool;
myBool = true;
cout << "check=" << check << " finished=" << finished
<< " myBool=" << myBool << endl;
int a = 4, b = 10;
cout << endl;
if (bigger(a, b)) {
cout << "a is bigger than b" << endl;
}
else {
cout << "a is not bigger than b" << endl;
}
if (bigger(b, a)) {
cout << "b is bigger than a" << endl;
}
else {
cout << "b is not bigger than a" << endl;
}
cout << endl;
// Loop until we reach a multiple 7 larger than 10;
int ii=0;
bool multOf7 = false;
bool bigger10 = false;
while (!(multOf7 and bigger10)) {
cout << ii << " ";
ii++;
if ((ii % 7) == 0) {
multOf7 = true;
}
else {
multOf7 = false;
}
bigger10 = ii > 10;
}
cout << endl;
// Loop until we reach a multiple 5 larger than 16
int jj=0;
while (!finished) {
cout << jj << " ";
jj++;
finished = ((jj % 5) == 0) ? (jj > 16) : false;
}
cout << endl;
return 0;
}