C++ programs on operators

Arithmetic Operators Example in C++

#include <iostream>
using namespace std;

int main ()
{
int a, b;
a = 10;
b = 5;

cout<<"a + b :" << a + b;
cout<<"a * b : "<< a * b;
cout<<"a - b: "<< a - b;
cout<<"a / b: "<< a / b;

cout<<"++a is : "<< ++a;
cout<<"--a is : "<< --a;

return 0;
}

Relational Operators Example in C++

#include <iostream>
using namespace std;

int main ()
{
int a, b ,c;
cin>>a>>b>>c;

if(a > b && a > c)
{
cout<<"a is biggest no ";
}
else if(b > c && b > a)
{
cout<<"b is biggest no ";
}
else if(c > a && c >b)
{
cout<<"c is biggest no ";
}
else
{
cout<<"All no are equal ";
}
return 0;
}

Logical Operators Example in C++

#include <iostream>
using namespace std;

int main ()
{
int a, b ,c;
cin>>a>>b>>c;

if(a > 0  || b > 0 || c > 0)
{
cout<<"One of them is greater than 0 ";
}

return 0;
}

Bitwise Operators Example in C++

#include <iostream>
using namespace std;

int main ()
{
int a, b ;
a = 0;
b = 1;
cout<<"a | b" << a|b;
cout<<"a & b" << a&b;
cout<<"~a" << ~a;

return 0;
}

Assignment operator Example in C++

#include <iostream>
using namespace std;

int main ()
{
int a, b;
a = 10;
b = 4;
a = b;
b = 7;

cout<<"a:";
cout<<a;
cout<<"b:";
cout<<b;

return 0;
}

Assignment operator Example 2 in C++

#include <iostream>
using namespace std;

int main ()
{
int a, b;
a = 10;
b = 4;
a = b;
b = 7;

cout<<"a:";
cout<<a;
cout<<"b:";
cout<<b;

return 0;
}

Conditional operator Example in C++

#include <iostream>
using namespace std;

int main ()
{
int a,b,c;

a=2;
b=7;
c = (a>b) ? a : b;

cout<<c << '
';
}

Size of Operator Example in C++ (Miscellaneous Operator)

#include <iostream>
using namespace std;

int main ()
{
int a,b,c;

a=2;
b=7;
c = (a>b) ? a : b;

cout<<c << '
';
}

Arithmetic Operators Example in C++

#include <iostream>
using namespace std;

int main ()
{
int a, b;
a = 10;
b = 5;

cout<<"a + b :" << a + b;
cout<<"a * b : "<< a * b;
cout<<"a - b: "<< a - b;
cout<<"a / b: "<< a / b;

cout<<"++a is : "<< ++a;
cout<<"--a is : "<< --a;

return 0;
}