program in c++ that can either 2 integers or 2 floating
point numbers and output the smallest number



program in c++ that can either 2 integers or 2 floating point numbers and output the smallest numbe..

Answer / makichut

#include <iostream>
using namespace std;
int smallest(int a, int b){
return (a<b) ? a:b;
}

float smallest(float a, float b){
return (a<b) ? a: b;
}

int main(){
cout<<smallest(10,20)<<endl;
cout<<samllest(10.2,20.2)<<endl;
return 0;
}

Is This Answer Correct ?    37 Yes 16 No

Post New Answer

More OOPS Interview Questions

How can you overcome the diamond problem in inheritance?

0 Answers   NIIT,


what type of questions

0 Answers   IBM,


What is the purpose of enum?

0 Answers  


What is inheritance in simple words?

0 Answers  


What is a macro? And how is a macro same as a template?

4 Answers  






write a c++ code to overload + and - for a stack class such that + provides push and - provides pop operation

1 Answers   College School Exams Tests, HCL, IBM, TCS,


What is virtual class and friend class?

5 Answers   IBS, Intel, Wipro,


What is object-oriented programming? Webopedia definition

0 Answers  


what is the application of oops?

8 Answers   IBM,


Which language is pure oop?

0 Answers  


Tell us about yourself.

47 Answers   ABB, Amazon, Fidelity, Flextronics, Franklin Templeton, HCL, Hexaware, IBM, Impetus, Infosys, Reliance, Rofous, Silgate, Sutherland, TCS, Thomson Reuters, Virtusa, Wipro,


Why is it so that we can have virtual constructors but we cannot have virtual destructors?

2 Answers  


Categories