Friday, 22 June 2012

write a c ++ program using class to check maximum number of two integer number using inline function and conditional operator

/*write a c ++ program using class to check maximum number  of two integer
number using inline function and conditional operator*/
#include<iostream.h>
#include<conio.h>
class check
{
int a,b;
public:inline void max()
       {
       cout<<"enter teh first number:-";
       cin>>a;
       cout<<"\nenter the second number:-";
       cin>>b;
       (a>b)?
       cout<<"\na="<<a<<" is greater"
       :
       cout<<"\nb="<<b<<" is greater";
       }
};
int main()
{
check c;
clrscr();
c.max();
getch();
return 0;
}
/*enter teh first number:-6

enter the second number:-3

a=6 is greater
*/

No comments: