6. Write a C++ program using class to check maximum of two integer numbers using Inline function and conditional operator.


#include<iostream.h>
#include<conio.h>
class max
{
public:
inline int maximum(int a,int b)
{
return a>b?a:b;
}
};
void main()
{
int a,b;
max m;
clrscr();
cout<<“\nEnter two number: “;
cin>>a>>b;
cout<<“\nNumber 1st: “<<a<<endl;
cout<<“\nNumber 2nd: “<<b<<endl;
cout<<“\nMaximum number is: “<<m.maximum(a,b)<<endl;
getch();
}

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s