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
What is oops in programming?
What is difference between inheritance and polymorphism?
What are the important components of cohesion?
What is pure oop?
What polymorphism means?
Can a destructor be called directly?
What is abstraction encapsulation?
what are the different types of qualifier in java?
What is the diamond problem in inheritance?
What is encapsulation in oops?
What is encapsulation and abstraction? How are they implemented in C++?
What is the purpose of polymorphism?
What is the real life example of polymorphism?
Why is encapsulation used?
What are the benefits of oop?