ALLInterview.com :: Home Page            
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
Google
   
 
Categories >> Software >> Programming Languages >> C++ >> OOPS
 
 


 

 
 STL interview questions  STL Interview Questions (90)
 OOPS interview questions  OOPS Interview Questions (554)
 C++ General interview questions  C++ General Interview Questions (458)
Question
write a c++ program to find maximum of two numbers using 
inline functions.
 Question Submitted By :: Shephaliaishwarya
I also faced this Question!!     Rank Answer Posted By  
 
  Re: write a c++ program to find maximum of two numbers using inline functions.
Answer
# 1
#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 ?    74 Yes 30 No
Manjunathtek
[Teknoturf Info Services Pvt. Ltd]
 
  Re: write a c++ program to find maximum of two numbers using inline functions.
Answer
# 2
#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 ?    26 Yes 27 No
Ada
 
 
 
  Re: write a c++ program to find maximum of two numbers using inline functions.
Answer
# 3
dont no 
Is This Answer Correct ?    1 Yes 0 No
Kani
 

 
 
 
Other OOPS Interview Questions
 
  Question Asked @ Answers
 
me get an assignent n its question is this 1.creat a set as in math i.ea={1,2} 2.insert element in it3. delete element don,t repeat any element 4.union 5. intersection of two sets plz help me i always pray for u n send me at ayeshawzd@hotmail.com f u have c++ how to program 5th addition then it is the 10.9 question in 10th chapter exercise   1
what is the use of classes in c++; HCL 2
Given two strings like x=?hello? and y=?open?, remove any character from string x which is also used in string y, thus making the result x=?hll?. IBM 13
What is the output of the following code: int v() { int m=0; return m++; } int main() { cout<<v(); } 1) 1 2) 0 3) Code cannot compile   4
Program to read a comment string IBM 1
What is the difference between declaration and definition?   19
what about you? wahat is your object? introduce your self? TCS 1
What is differance between Abstract and Interface   3
Can we create object of class with private constructor?   5
what is multithreading in c++ , what is difference between multithreading and singlethreading.   4
What is the differances between a abstract calss and interface Aviva 5
is java purely oop Language? Infosys 49
 
For more OOPS Interview Questions Click Here 
 
 
 
 
 


   
Copyright Policy  |  Terms of Service  |  Articles  |  Site Map  |  RSS Site Map  |  Contact Us
   
Copyright 2013  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  KalAajKal.com