Comments

Tuesday, August 27, 2013

Find the Bigger number of the 3

Posted by at 3:45 AM Read our previous post


Object:

Find the Bigger number of the 3
Source Code:


#include <iostream>
using namespace std;

class number
{

private:

public:

       int check(int a,int b, int c)
       {
              int ary[3];
              ary[0]=a;
              ary[1]=b;
              ary[2]=c;
              int max=-1;
             
             
              for(int n=0;n<3;n++)
              {
                     for (int m=1;m<3;m++)
                     {
                           if(ary[n]>ary[m])
                           {
                             max=ary[n];
                           }
                    
                    
                     }

              }

              return(max);
       }




};

void main ()
{
       ///////// Taking input from user ////////////////////
       int first,second,third,maximum;
       cout<<"Enter First Digit"<<endl;
       cin>>first;
       cout<<"Enter Second Digit"<<endl;
       cin>>second;
       cout<<"Enter Third Digit"<<endl;
       cin>>third;
      
       /////////////// Class obj numb///////////////////////
       number numb;

       //////////// return from check func of class number//
       maximum=numb.check(first,second,third);
      
       cout<<"Bigger number is : "<<maximum<<endl;
}

Output:
 

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Popular Posts

Labels

© Codepirate is powered by Blogger - Template designed by Stramaxon - Best SEO Template