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 are the components of marker interface?

602


What is encapsulation in ict?

608


write a program to find 2 power of a 5digit number with out using big int and exponent ?

1895


Why do we use class?

635


What is polymorphism in oop example?

515






What are oops functions?

585


design a c++ class for the chess board,provide a c++ class definition for such class(only class definition is required)

6154


What is the importance of oop?

612


Which type does string inherit from?

616


What is polymorphism oop?

623


Why is oop better than procedural?

604


what type of question are asked in thoughtworks pair programming round ?

1763


can we make game by using c

3429


Why do we use oop?

605


What is difference between inheritance and polymorphism?

573