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

Which is faster post increment or pre increment ? and in which cases should u use either - to increase speed?

4 Answers   EA Electronic Arts,


What are virtual functions?

2 Answers  


What is object in oop with example?

0 Answers  


Write A Program using Single and Multiple Inheritance.

1 Answers  


what type of questions

0 Answers   IBM,






what is the difference between class and structure in C++?

9 Answers   Aspire, IBS, TCS,


Explain polymorphism? What r the types of polymorphism? pls give examples?

4 Answers   HCL,


write a program which best describes polymorphism in real world?

2 Answers   CTS, Infosys, NexGen,


c++ program to swap the objects of two different classes

0 Answers  


Program to check whether a word starts with a capital letter or not.

1 Answers   Infosys,


What is abstract class in oops?

0 Answers  


Out of 4 concepts, which 3 C++ Follow?

1 Answers   TCS,


Categories