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 |
Why is polymorphism used?
Explain the advantages of inheritance.
Explain virtual inheritance?
why the argument is passed by reference to a copy constructor?example?
How can you overcome the diamond problem in inheritance?
How would you stop a class from class from being derived or inherited.
what is abstract class ? when is used in real time ? give a exp
If a=5, b=6, c=7, b+=a%c*2. What is the final value of b?
diff between Virtual mathod and abstract method?
what type of question are asked in thoughtworks pair programming round ?
what is the 3 types of system development life cycle
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.