-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathoperators.cpp
More file actions
39 lines (29 loc) · 979 Bytes
/
operators.cpp
File metadata and controls
39 lines (29 loc) · 979 Bytes
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
#include <iostream>
using namespace std;
int main() {
// Arithmetic Operator - operators which helps in doing mathematical calculations
// arithmetic operators - + - * / % (modules operator - for remainders of divison)
int x = 2;
int y = 4;
// add
cout << x+y << "\n";
// subtract
cout << y-x << "\n";
// multiply
cout << x*y << "\n";
// divide
cout << y/x << "\n";
return 0;
// Assignment operator - these are used to assign values :
// = += -= *= /= %=
int increment;
increment += 13; // is also increment = increment +13;
// comparison (relational) operator
// ==(equals to) , !=(not equals to) , >(greater than), <(smaller than), >= (greater than or equal to), <= (less than or equals to)
int a = 12;
int b = 13;
bool c = a>b; // output - false
// logical operators
// && (and), || (or), !(not)
cout << increment;
}