Advertisement
steverobinson

Biggest among two numbers

Oct 12th, 2010
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.63 KB | None | 0 0
  1. /* Biggest Among two Numbers Using Class*/
  2. /*             Language: C++            */
  3.  
  4.  
  5.  
  6. #include <iostream.h>
  7. #include <conio.h>
  8.  
  9. class numbers
  10. {
  11.     int a,b;
  12.  
  13.     public:
  14.         numbers(int x,int y)
  15.         {
  16.             a=x;
  17.             b=y;
  18.         }
  19.         int compare()
  20.         {
  21.             if(a>b)
  22.                 return a;
  23.             else
  24.                 return b;
  25.         }
  26. };
  27.  
  28. int main()
  29. {
  30.     system("cls");
  31.     int a,b;
  32.     cout<<"\nEnter two Numbers: ";
  33.     cin>>a>>b;
  34.     numbers num1(a,b);
  35.     cout<<"\nThe Biggest Among the given two number is: "<<num1.compare();
  36.     getch();
  37.     return 0;
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement