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

By | December 28, 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

 

 

Leave a Reply