#include<iostream>
#include<conio.h>
using namespace std;
class xyz;
class abc
{
int a,b;
public:
virtual void getA()
{
cout<<"\nEnter the value of A:";
cin>>a;
}
void getB()
{
cout<<"\nEnter the value of B:";
cin>>b;
}
friend void max(abc,xyz);
};
class xyz
{
int x,y;
public:
virtual void getX()
{
cout<<"\nEnter the value of x:";
cin>>x;
}
void getY()
{
cout<<"\nEnter the value of Y:";
cin>>y;
}
friend void max(abc,xyz);
};
void max(abc a1,xyz x1)
{
if(a1.a > x1.x)
{
cout<<"\n"<<"A is greter";
}
else
{
cout<<"\n"<<"x is greter";
}
}
void max(abc b1,xyz y1)
{
if(abc b1,xyz y1)
{
cout<<"\n"<<"b is greter";
}
else
{
cout<<"\n"<<"y is greter";
}
}
int main()
{
abc a;
abc b;
xyz x;
xyz y;
a.getA();
x.getX();
b.getB();
y.getY();
max(a,x);
max(b,y);
getch();
}
No comments:
Post a Comment