program in c++ that can either 2 integers or 2 floating
point numbers and output the smallest number
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 |
What are the 5 oop principles?
oops concept is used for?
Can we have a private constructor ?
12 Answers HSBC, Ness Technologies, TCS, Wipro,
What do you mean by overloading?
Which method cannot be overridden?
What is the renewal class?
What is deep and shalow copy?
What is virtual destructor? Why?
3 Answers Agile Software, College School Exams Tests, CSC,
What is advantage of inheritance?
What is the difference between declaration and definition?
What is difference between class and object with example?
What is the difference between const int *ptr and int const *ptr???