Q:

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

0

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

 

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

#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

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

C++ Classes and Objects Solved Programs

This question belongs to these collections

Similar questions


need a help?


find thousands of online teachers now
Write a C++ program to Swap two numbers using clas... >>
<< Write a C++ program to display Entered Time using ...