Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* Biggest Among two Numbers Using Class*/
- /* Language: C++ */
- #include <iostream.h>
- #include <conio.h>
- class numbers
- {
- int a,b;
- public:
- numbers(int x,int y)
- {
- a=x;
- b=y;
- }
- int compare()
- {
- if(a>b)
- return a;
- else
- return b;
- }
- };
- int main()
- {
- system("cls");
- int a,b;
- cout<<"\nEnter two Numbers: ";
- cin>>a>>b;
- numbers num1(a,b);
- cout<<"\nThe Biggest Among the given two number is: "<<num1.compare();
- getch();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement