GREATEST AMONG THREE VARIABLE

     #include<iostream.h>
     #include<conio.h>
     class greatest
     {
       //global variable
       int x,y,z;
       public:
       //local variable is m & n
       void input(int m,int n,int o)
       {
        x=m;
        y=n;
        z=o;
       }

       void find()
       {
    if(x>y)
    {
        if(x>z)
        {
        cout<<"\n\t"<<x<<" is greater";
        }
        else
        {
         cout<<"\n\t"<<z<<" is greater";
        }
    }
    else if(y>z)
    {
     cout<<"\n\t"<<y<<" is greater";
    }
    else
    {
     cout<<"\n\t"<<z<<" is greater";
    }
       }
     };

      void main()
      {
    int x,y,z;
    clrscr();
     greatest obj;
     cout<<"\n\tEnter Number1 ";
     cin>>x;
     cout<<"\n\tEnter Number2 ";
     cin>>y;
     cout<<"\n\tEnter Number3 ";
     cin>>z;

     obj.input(x,y,z);
     obj.find();
    getch();

      }

No comments:

Post a Comment

Programmingway@Eklavya Technosys!: JAC Board Computer Examination Sample Questions Hi...

Programmingway@Eklavya Technosys!: JAC Board Computer Examination Sample Questions Hi... : 1) Which of the following is NOT a web service? (...