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

Answer Posted / 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       View All Answers


Please Help Members By Posting Answers For Below Questions

What is oops in programming?

649


What is difference between inheritance and polymorphism?

668


What are the important components of cohesion?

639


What is pure oop?

688


What polymorphism means?

703






Can a destructor be called directly?

689


What is abstraction encapsulation?

749


what are the different types of qualifier in java?

1919


What is the diamond problem in inheritance?

674


What is encapsulation in oops?

633


What is encapsulation and abstraction? How are they implemented in C++?

720


What is the purpose of polymorphism?

760


What is the real life example of polymorphism?

712


Why is encapsulation used?

659


What are the benefits of oop?

704