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



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

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

Post New Answer

More OOPS Interview Questions

Why is polymorphism used?

0 Answers  


Explain the advantages of inheritance.

0 Answers   TCS,


Explain virtual inheritance?

0 Answers  


why the argument is passed by reference to a copy constructor?example?

2 Answers  


How can you overcome the diamond problem in inheritance?

0 Answers   NIIT,


How would you stop a class from class from being derived or inherited.

18 Answers   Ness Technologies,


what is abstract class ? when is used in real time ? give a exp

5 Answers  


If a=5, b=6, c=7, b+=a%c*2. What is the final value of b?

1 Answers  


diff between Virtual mathod and abstract method?

1 Answers  


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

0 Answers   Thought Works,


what is the 3 types of system development life cycle

1 Answers  


Question: Implement a base class Appointment and derived classes Onetime, Daily, Weekly, and Monthly. An appointment has a description (for example, “see the dentist”) and a date and time. Write a virtual function occurs_on(int year, int month, int day) that checks whether the appointment occurs on that date. For example, for a monthly appointment, you must check whether the day of the month matches. Then fill a vector of Appointment* with a mixture of appointments. Have the user enter a date and print out all appointments that happen on that date.

0 Answers  


Categories