-
Notifications
You must be signed in to change notification settings - Fork 0
/
operators.cpp
43 lines (35 loc) · 1.42 KB
/
operators.cpp
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
#include <iostream>
using namespace std;
int main(){
int a=4,b=5;
cout<< "Following are the types of operators in c++:"<<endl;
// Arthmetic operators
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;
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;
cout<<endl;
// Assignment Operators --> Used to assign values to variables
// int a=3, b=9;
// chat d="A";
// Comparison Operators
cout<<"Following are the types of compatison opeators in C++"<<endl;
cout<<"The vlaue of a==b is "<<(a==b)<<endl;
cout<<"The vlaue of a!=b is "<<(a!=b)<<endl;
cout<<"The vlaue of a>=b is "<<(a>=b)<<endl;
cout<<"The vlaue of a<=b is "<<(a<=b)<<endl;
cout<<"The vlaue of a>b is "<<(a>b)<<endl;
cout<<"The vlaue of a<b is "<<(a<b)<<endl;
cout<<endl;
// Logical Operators
cout<< "Following are the logical operators in C++"<<endl;
cout<< "The value of (a==b)&&(a<b) logical operator is "<<((a==b)&&(a<b))<<endl;
cout<< "The value of (a==b)||(a<b) logical operator is "<<((a==b)||(a<b))<<endl;
cout<< "The value of !((a==b)||(a<b)) is "<<(!(a==b)||(a<b))<<endl;
return 0;
}