-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtutorial3.cpp
More file actions
75 lines (57 loc) · 1.37 KB
/
tutorial3.cpp
File metadata and controls
75 lines (57 loc) · 1.37 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
67
68
69
70
71
72
73
74
#include <iostream>
#include <iomanip>
#define NUM 20 //// declaring for question 5
using namespace std;
int main(){
cout<<"==== Question 1 ====" <<endl;
cout << ('A' < 'B') <<endl;
cout << ('a' == 'A') <<endl;
cout << ('a' < 'B') <<endl;
cout<<endl;
cout<<"==== Question 2 ====" <<endl;
int int1 = 12, int2 = 18, int3 = 21;
cout << (int1 < int2 && int2 < int3) <<endl;
cout << (int1 < int3 || int3 < int2) <<endl;
cout << (int1 <= int2 - 6) <<endl;
cout << (int2 <= int1 + 5 || int3 >= int2 +5) <<endl;
cout << (!(int2 == int1 && int3 == int1)) <<endl;
cout << (!(int1 > 25) && !(int2 <17)) <<endl;
cout<<endl;
cout<<"==== Question 3 ====" <<endl;
cout << (1 + 2 * 4/2) <<endl;
cout << ((1 + 2) * 4/2) <<endl;
cout << (9 % 2 + 1) <<endl;
cout << ((1 + (10 - (2 + 1)))) <<endl;
cout << (557%8 * 3 - 9) <<endl;
cout << ((234/5) * 4 - 7%3) <<endl;
cout<<endl;
cout<<"==== Question 4 ====" <<endl;
int a, b = 4, c = 0;
//// 5a)
a = ++b - ++c;
cout<<"5a) a="<<a<<" b="<<b<<" c="<<c<<endl;
a = NULL;
b = 4;
c = 0;
//// 5b)
//
//a = b-- + --c;
cout<<"5b) a="<<a<<" b="<<b<<" c="<<c<<endl;
//
// a = NULL;
// b = 4;
// c = 0;
//
// //// 5c)
// a = b++ + ++c;
// cout<<"5c) a="<<a<<" b="<<b<<" c="<<c<<endl;
//
// a = NULL;
// b = 4;
// c = 0;
//
// //// 5d)
// b = a = c--;
// cout<<"5d) a="<<a<<" b="<<b<<" c="<<c<<endl;
return 0;
}