/* Nesting of member function */
#include<iostream>
using namespace std;
class Sample
{
int a,b;
public:
void accept()
{
cout<<"\n\n Enter any two number: ";
cin>>a>>b;
}
void display()
{
cout<<"\n A: "<<a<<"\n B: "<<b;
max();
}
void max()
{
if(a>b)
cout<<"\n n A is greater.";
else if(a<b)
cout<<"\n\n B is greater.";
else
cout<<"\n\n Both are equal.";
}
};
int main()
{
Sample s;
s.accept();
s.display();
return 0;
}
#include<iostream>
using namespace std;
class Sample
{
int a,b;
public:
void accept()
{
cout<<"\n\n Enter any two number: ";
cin>>a>>b;
}
void display()
{
cout<<"\n A: "<<a<<"\n B: "<<b;
max();
}
void max()
{
if(a>b)
cout<<"\n n A is greater.";
else if(a<b)
cout<<"\n\n B is greater.";
else
cout<<"\n\n Both are equal.";
}
};
int main()
{
Sample s;
s.accept();
s.display();
return 0;
}