Repository navigation
Expand file tree
/
Copy path4_operators.cpp
More file actions
49 lines (40 loc) · 1.78 KB
/
Copy path4_operators.cpp
File metadata and controls
49 lines (40 loc) · 1.78 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
49
#include <iostream>
using namespace std;
int main()
{
int a = 4, b = 5;
// cout << "Operators in C++:" << endl;
// cout << "Following are the types of operators in C++" << endl;
// // Arithmetic 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;
// a*=b;
// cout<<a<<endl;
// cout<<b<<endl;
// char d='d';
// Comparison operators
// cout << "Following are the comparison operators in C++" << 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;
// cout << "The value of a < b is " << (a < b) << endl;
// // Logical operators
// 1. && 2.|| 3. !
cout << "Following are the logical operators in C++" << endl;
cout << "The value of this logical and operator ((a==b) && (a<b)) is:" << ((a == b) && (a < b)) << endl;
cout << "The value of this logical or operator ((a==b) || (a<b)) is:" << ((a == b) || (a < b)) << endl;
cout<<"The value of this logical not operator (!(a==b)) is:"<<(!(a==b))<<endl;
return 0;
}