-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMid-Term.cpp
More file actions
106 lines (94 loc) · 2.11 KB
/
Copy pathMid-Term.cpp
File metadata and controls
106 lines (94 loc) · 2.11 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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
#include "iostream"
#include <Math.h>
#define PI 3.14
using namespace std;
int multiplyByTwo(int a){
int result;
result = a << 1;
return result;
}
int divideByTwo(int a){
int result;
result = a >> 1;
return result;
}
int main (){
//-----------assignment--------------
//int a,b;
//cin >> a;
//multiply by 2
//int result = a << 1;
//divide by 2
//result = a >> 1;
//int result = a;
//for (int i = 0; i < 3; i++){
// result = multiplyByTwo(result);
//}
////result = divideByTwo(result);
////3 barabar sepas nesf
//int result;
//result += a << 1;
//result += a << 1;
//result += a << 1;
//
//result = result >> 1;
//result = result >> 1;
//cout << result <<endl;
//
////1/4 sepas 5 barabar
//int result2 = a;
//result2 = a >> 1;
//result2 = result2 >> 1;
//
//result2 = result2 << 1;
//result2 = result2 << 1;
//result2 = result2 << 1;
//result2 += a << 1;
//result2 = result2 >> 1;
//
//
//cout << result2;
//soal 1
//float a,b,c,d;
//while(1){
// cin >> a >> b >> c >> d;
// if ((a == 0 || a == 1) || (b == 0 || b == 1) || (c == 0 || c == 1) || (d == 0 || d == 1)){
// cout << "error try again"<<endl;
// }
// else break;
//}
//if (a > c){
// float sum = a + b + c + d;
// cout << "Average :" << sum / 4 <<endl;
//}
//int dInt = d, bInt = b;
//if (dInt % bInt == 0){
// cout << "4th Number can be divided to 2nd Number :" << (a / 2) + (b / 2) + (c / 2) + (d / 2) << endl;
//}
//if (a > b){
// cout << "3rd Number With a Power of Two :"<< c * c <<endl;
//}
////soal 2
//float number = 3.14;
//cout << "ceil :" <<ceil(number) << endl;
//cout << "floor :" << floor(number) << endl;
//soal 3
//int reservedPin[4];
//reservedPin[0] = 7;
//reservedPin[1] = 4;
//reservedPin[2] = 3;
//reservedPin[3] = 1;
//
//int pin [4];
//cout << "Enter Pin" << endl;
//cin >> pin[0] >> pin[1] >> pin[2] >> pin[3];
//if ((pin[0] == reservedPin[0]) && (pin[1] == reservedPin[1]) && (pin[2] == reservedPin[2]) && (pin[3] == reservedPin[3])){
// cout << "Success";
//}
//else{
// cout << "wrong Pin";
//}
system("color C");
//cout << endl;
system("pause");
}