-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path05_Operators.cpp
38 lines (32 loc) · 1.35 KB
/
05_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
#include<iostream>
using namespace std;
int main()
{
cout << "Operators in C++ : " << endl << endl;
// endl is for printing the next line of code to the new line
// Arithmetic Operators...!!
int a = 3, b=6;
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; //First print and then increment.
cout << "The value of ++a is : " << ++a << endl; //First increment then print it.
cout<< endl;
// Assignment Operators
int c = 5;
char d = 'r';
//Comparison Operators
cout << "The value of a == b : " << (a==b) << endl;
cout << "The value of a != b : " << (a!=b) << endl;
cout << "The value of a >= b : " << (a>=b) << endl;
cout << "The value of a <= b : " << (a<=b) << endl;
cout << "The value of a > b : " << (a>b) << endl;
cout << "The value of a < b : " << (a<b) << endl << endl;
//Logical Operators
cout << "The value of (a==b) && (a<b) : " << ((a==b) && (a<b)) << endl;
cout << "The value of (a==b) || (a<b) : " << ((a==b) || (a<b)) << endl;
cout << "The value of !(a==b) : " << (!(a==b)) << endl;
return 0;
}