Write a C++ program to find Largest among 2 numbers using class

By | 28.12.2016

Write a C++ program to find Largest among 2 numbers using class

#include<iostream>
using namespace std;
class biggest
{
   private:
        int a,b;
        public:
                void input();
                void display();
        
                
};
void biggest::input()
{
        cout<<"Enter 2 nos.:";
        cin>>a>>b;
}
void biggest::display()
{
        if(a>b)
        cout<<"Biggest no.:"<<a;
        else
        cout<<"Biggest no.:"<<b;
}
int main()
{
        biggest b;
        b.input();
        b.display();
        
}

 

OUTPUT ::

 

Enter 2 nos.:33 44

Biggest no.:44

 

 

5 2 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments