-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathOP.cpp
More file actions
87 lines (49 loc) · 1.64 KB
/
OP.cpp
File metadata and controls
87 lines (49 loc) · 1.64 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
#include <iostream>
#include <string>
using namespace std;
int main(){
int num1=6; //your input goes here
int num2=3; //your input goes here
//AO
cout<< num1+num2<<endl; //addition
cout<< num1-num2<<endl;//subtration
cout<< num1*num2<<endl;//multiplication
cout<< num1/num2<<endl;//division
cout<< num1%num2<<endl; //Modulus
//RO
cout<< (num1==num2)<<endl; //Equals to
cout<< (num1!=num2)<<endl; //not equals to
cout<< (num1>=num2)<<endl; //greater than/less than equals to
//Assignment Operators
num1+=2; //your input goes here
cout<<num1<<endl; //Adds number
num1-=2; //your input goes here
cout<<num1<<endl; //subs number
num1/=2; //your input goes here
cout<<num1<<endl; //Divides number
num1%=2; //your input goes here
cout<<num1<<endl; //Modulus number
//Bitwise Operators
int num3=5; //your input goes here
int num4=8; //your input goes here
cout<<(num3<<1)<<endl; //Multiplies by 2^num3
cout<<(num3>>1)<<endl; //Divides by 2^num3
cout<<(num3&num4)<< endl;//AND gate
cout<<(num3|num4)<< endl;//OR gate
cout<<(num3^num4)<< endl;//EXCLUSIVE OR gate
//Misc Operators
int a=4;
cout<<sizeof(a)<<endl; //sizeOf Operator
char name='abssw';
cout<<sizeof(name)<<endl; //SizeOf Operator
bool flag;
a==name? flag=true: flag= false;
cout<<flag<<endl;//0 because Int is not equal to char
cout<<(&a)<<endl; //Finds Memory address of Variable
int b=6;//Unary Operators
cout<<(b++)<<endl; //Post-Increment Operator
cout<<(+b)<<endl; //Pre-Increment Operator
cout<<(b--)<<endl; //Post-Decrement Operator
cout<<(--b)<<endl; //Pre-Decrement Operator
return 0;
}