Write a C++ Program to find Largest among 3 numbers using classes
#include<iostream>
using namespace std;
class greatest
{
private:
int x,y,z;
public:
void input()
{
cout<<"Enter 3 nos.";
cin>>x>>y>>z;
}
void calc()
{
int r;
r=((x>y)&&(x>z)?x:(y>x)&&(y>z)?y:z);
cout<<"Greatest no:"<<r;
}
};
int main()
{
greatest g;
g.input();
g.calc();
}
OUTPUT ::
Enter 3 nos.5 9 2 Greatest no: 9