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 |
How can you overcome the diamond problem in inheritance?
what type of questions
What is the purpose of enum?
What is inheritance in simple words?
What is a macro? And how is a macro same as a template?
write a c++ code to overload + and - for a stack class such that + provides push and - provides pop operation
1 Answers College School Exams Tests, HCL, IBM, TCS,
What is virtual class and friend class?
What is object-oriented programming? Webopedia definition
what is the application of oops?
Which language is pure oop?
Tell us about yourself.
47 Answers ABB, Amazon, Fidelity, Flextronics, Franklin Templeton, HCL, Hexaware, IBM, Impetus, Infosys, Reliance, Rofous, Silgate, Sutherland, TCS, Thomson Reuters, Virtusa, Wipro,
Why is it so that we can have virtual constructors but we cannot have virtual destructors?