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

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 Answers  


Why and when is a virtual destructor needed?

5 Answers  


What is virtual Function.

1 Answers   Wipro,


Why we use classes in oop?

0 Answers  


What is the example of polymorphism?

0 Answers  






What is this interview room ? Is it a class or an object.

3 Answers   CybAge, NSN, Wipro,


can you give real time example for polymarphism

5 Answers   TCS,


Prepare me a program for the animation of train

0 Answers  


What are benefits of oop?

0 Answers  


Why u change company?

12 Answers   BOB Technologies,


Write a program to accept a number and to print numbers in pyramid format? for eg:for a no. 5 1 212 32123 4321234 543212345

7 Answers  


What is polymorphism what are the different types of polymorphism?

0 Answers  


Categories