-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtut5.cpp
More file actions
48 lines (40 loc) · 1.74 KB
/
tut5.cpp
File metadata and controls
48 lines (40 loc) · 1.74 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
#include<iostream>
/* there are two types of header file
1) system header files - comes with the compiler
eg:- #include<iostream>
2) user defined header files - it is written by the programmer
eg:- #include"this.h" (will produce error if the file is not found in the current directory) */
using namespace std;
int main() {
int a=6, b=9;
cout<<"operators in c++"<<endl;
cout<<"following are the operators in c++"<<endl;
//arithermatic operators
cout<<"Arithematic operators"<<endl;
cout<<"\n";
cout<<"the value of a + b is "<<a+b<<endl;
cout<<"the value of a x 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<<"\n";
//comparison operators
cout<<"Comparison operators"<<endl;
cout<<"\n";
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 > b is "<<(a>b)<<endl;
//Logical operators
cout<<"Logical operators"<<endl;
cout<<"value of the following logical operator <<((a==b) && --> and operator (a<b)) is "<<((a==b) && (a<b))<<"\n";
cout<<"value of the following logical operator <<((a==b) || --> or operator (a<b)) is "<<((a==b) || (a<b))<<"\n";
cout<<"value of the following logical operator !(a==b) is "<<!(a==b)<<"\n";
return 0;
}