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

what is the advantage in software? what is the difference between the software developer and Engineer

1 Answers  


what is graphics

0 Answers  


What are oops methods?

0 Answers  


What is virtual class and friend class?

5 Answers   IBS, Intel, Wipro,


why constructor cannt be declar virtually? why destructor cannt be overloaded?

2 Answers   Infosys,






What is the difference between XML Web Services using ASMX and .NET Remoting using SOAP?

1 Answers  


What is debug class?what is trace class? What differences are between them? With examples.

0 Answers  


What does no cap mean?

0 Answers  


c++ is a purely oop concept?

3 Answers   Google, TCS,


Question: Write a program that prints a paycheck. Ask the program user for the name of the employee, the hourly rate, and the number of hours worked. If the number of hours exceeds 40, the employee is paid “time and a half”, that is, 150 percent of the hourly rate on the hours exceeding 40. Be sure to use stepwi se refine ment and break your solution into several functions. Use the int_name function to print the dollar amount of the check.

0 Answers  


what's the basic's in dot net

0 Answers   informatics,


what are the ways in which a constructors can be called?

0 Answers  


Categories