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

Why we use classes in oop?

586


What does it mean when someone says I oop?

587


What is overloading in oop?

579


What is a class and object?

600


hi, this is raju,iam studying b.tech 2nd year,iam want know about group1 and group2 details, and we can studying without going to any instutions? please help me.

1545






What is oops?what is its use in software engineering?

561


What is property in oops?

571


What is encapsulation with example?

583


any one please tell me the purpose of operator overloading

1967


write string class as your own class in java without using any built-in function

1981


What is for loop and its syntax?

599


How to use CMutex, CSemaphore in VC++ MFC

4335


Is enum a class?

607


class type to basic type conversion

1843


Write a C++ program without using any loop (if, for, while etc) to print prime numbers from 1 to 100 and 100 to 1 (Do not use 200 print statements!!!)

1644