Answer to Question #233122 in C++ for alice

Question #233122

Code a C++ function Min() that takes three double type arguments and that returns the

value of the smallest of the three arguments.


1
Expert's answer
2021-09-06T13:19:39-0400
#include<iostream>
using namespace std;
double Min(double first, double second, double third){
	double min = first;
	if(second<third && second<first){
		min = second;
	}
	else if(third < first && third< second){
		min = third;
	}
	return min;
}
//Testing code
int main(){
	double first, second, third;
	cout<<"Enter the first number\n";
	cin>>first;
	cout<<"Enter the second number\n";
	cin>>second;
	cout<<"Enter the third number\n";
	cin>>third;
	cout<<"The value of the smallest number is:  \t"<<Min(first, second, third);
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS