Comparision Operators Examples in C++


Example Program

Here is the simple program for Comparision Operators Examples in C++.

Source Code Example : 1

#include<iostream>
using namespace std;
int main()
{
    int x=10,y=10;
    if(x==y)
    {
        cout<<"\nEqual to : "<<x;
    }
    return 0;
}
To download raw file Click Here

Output

Equal to : 10

Source Code Example : 2

#include<iostream>
using namespace std;
int main()
{
    int x=10,y=5;
    if(x>y)
    {
        cout<<"\nGreatest value : "<<x;
    }
    return 0;
}
To download raw file Click Here

Output

Greatest Value: 10

Source Code Example : 3

#include<iostream>
using namespace std;
int main()
{
    int x=10,y=5;
    if(x>=y)
    {
        cout<<"\nGreater than or equal to : "<<x;
    }
    return 0;
}
To download raw file Click Here

Output

Greater than or equal to : 10

Source Code Example : 4

#include<iostream>
using namespace std;
int main()
{
    int x=10,y=15;
    if(x<y)
    {
        cout<<"\nSmallest value : "<<x;
    }
    return 0;
}
To download raw file Click Here

Output

Smallest value : 10

Source Code Example : 5

#include<iostream>
using namespace std;
int main()
{
    int x=10,y=15;
    if(x<=y)
    {
        cout<<"\nSmaller than or equal to : "<<x;
    }
    return 0;
}
To download raw file Click Here

Output

Smaller than or equal to :10

Source Code Example : 6

#include<iostream>
using namespace std;
int main()
{
    int x=10,y=5;
    if(x!=y)
    {
        cout<<"\nNot Equal to : "<<x;
    }
    return 0;
}
To download raw file Click Here

Output

Not equal to: 10

Basic Programs


Flow Control

IF Statement Examples


Switch Case


Goto Statement


Break and Continue


While Loop


Do While Loop


For Loop


Friend Function in C++


String Examples


Array Examples


Structure Examples


Structure & Pointer Examples


Structure & Functions Examples


Enumeration Examples


Template Examples


Functions


Inheritance Examples

Hierarchical Inheritance


Hybrid Inheritance


Multilevel Inheritance


Multiple Inheritance


Single Level Inheritance


Class and Objects

Constructor Example


Destructor Example


Operator Overloading Example


List of Programs


Pointer Examples


Memory Management Examples


Pointers and Arrays


Virtual Function Examples



Learn All in Tamil © Designed & Developed By Tutor Joes