-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path3oper.cpp
More file actions
35 lines (30 loc) · 1.35 KB
/
Copy path3oper.cpp
File metadata and controls
35 lines (30 loc) · 1.35 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
#include<iostream>
using namespace std;
int a = 3; //global value
int main(){
int a = 4; //local value These also
int b = 5; //assignment operators
cout<<"Operators"<<endl;
cout<<"Following are the types of operators"<<endl;
//Arithmetic operators
cout<<"\nThe value of a + b is "<<::a+b<<endl; // :: is used to use the global value
cout<<"The value of a - b is "<<a-b<<endl;
cout<<"The value of a * b is "<<a*b<<endl;
cout<<"The value of a / b is "<<a/b<<endl;
cout<<"The value of a % b is "<<a%b<<endl;
cout<<"The value of a++ is "<<a++<<endl;
cout<<"The value of ++a is "<<++a<<endl;
cout<<"The value of a-- is "<<a--<<endl;
cout<<"The value of --a is "<<--a<<endl;
//comparison operators
cout<<"\nThe value of a == b is "<<(a==b)<<endl; // :: is used to use the global value
cout<<"The value of a < b is "<<(a<b)<<endl;
cout<<"The value of a > b is "<<(a>b)<<endl;
cout<<"The value of a <= b is "<<(a<=b)<<endl;
cout<<"The value of a >= b is "<<(a>=b)<<endl;
cout<<"The value of a != b is "<<(a!=b)<<endl;
//Logical operators
cout<<"\nThe value of ((a==b) && (a<b)) logical operator is "<<((a==b) && (a>b))<<endl; //and operator
cout<<"\nThe value of ((a!=b) || (a>b)) logical operator is "<<((a!=b) || (a>b))<<endl; //or operator
return 0;
}