Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


write a c++ program to find maximum of two numbers using
inline functions.

Answers were Sorted based on User's Feedback



write a c++ program to find maximum of two numbers using inline functions...

Answer / manjunathtek

#include<iostream>
using namespace std;
int main()
{
int c;
c=max(5,4); //will display 5
cout<<c<<endl;
return 0;
}
inline int max(int a, int b)
{
return (a>b)? a:b;
}

Is This Answer Correct ?    140 Yes 52 No

write a c++ program to find maximum of two numbers using inline functions...

Answer / kani

dont no

Is This Answer Correct ?    15 Yes 4 No

write a c++ program to find maximum of two numbers using inline functions...

Answer / ada

#include <iostream>
using namespace std;

template<typename T>
inline T& max(T& x, T& y)
{
return x>y ? x:y;
}

int main()
{
char bx = 'a', by = 'b';
int ix = 1, iy = 2;
float fx = 1.5, fy = 2.5;
double dx = 2.5, dy = 1.5;
cout<<"char max:"<<max(bx, by)<<endl;
cout<<"int max:"<<max(ix, iy)<<endl;
cout<<"float max:"<<max(fx, fy)<<endl;
cout<<"double max:"<<max(dx, dy)<<endl;
return 0;
}

Is This Answer Correct ?    39 Yes 33 No

Post New Answer

More OOPS Interview Questions

If a=5, b=6, c=7, b+=a%c*2. What is the final value of b?

1 Answers  


i hav very low percentage in 12th n BSCwhich is around 50.......coz it was just imposed on me 2 b a science graduate,nw m doin MCA n hav aggregate 74% ....what shud i answer if company's HR ask me about dis much low previous percentage??????

3 Answers   Infosys,


What is multilevel inheritance?

0 Answers  


what is the difference between inter class and abstract class...?

0 Answers  


what are the disadvantages of C++?

25 Answers   ATS, Infosys, UNI, Wipro,


create a c++ program that will accepts 9 inputs using 3 by 3 array.

1 Answers  


What does I oop mean?

0 Answers  


what is different between oops and c++

0 Answers   IIT,


Difference between new operator and operator new

2 Answers  


what is difference between String s=new String("vali"); String s="vali"

1 Answers  


In multiple inheritance , to create sub class object , is there need to create objects for its superclasses??? in java and c++ both. Actually i have some information that is , all available members from its superclasses , memory created in subclass obj , so no need to create object for its superclasses...??? Thanks in Advance

1 Answers  


Can destructor be overloaded?

0 Answers  


Categories