Popular Posts

7. Write a program to take two value and show the largest one by using nesting of member function .

7. Write a program to take two value and show the largest one by using nesting of member function .


#include
#include
class set
{
int m,n;
public:
void input(void);
void display(void);
int largest(void);
};
int set::largest(void)
{
if(m>=n)
return(m);
else
return(n);
}
void set ::input(void)
{
cout<<"Input values of m and n"<<"\n"; cin>>m>>n;
}
void set::display(void)
{
cout<<"Largest value= "< }
int main()
{
set a;
a.input();
a.display();
getch();
return 0;
}

Output:
Input values of m and n
15
18
Largest value= 18

No comments: