Answer to Question #4520 in C++ for David Obot Umoekah

Question #4520
Your program reads float numbers and during the reading every time the (absolute) biggest number
is printed. To do so, use a function Find_max() that from two numbers returns the biggest.
The program ends after entering the number 0.

draw PSD for the program before writing program.
1
Expert's answer
2011-10-13T08:15:34-0400
#include <cstdlib>
#include <iostream>

using namespace std;
float a,b,Max;
float Find_max(float a,float b)
{
if (a>=b) return Max=a;
else return Max=b;
}
int main(int argc, char *argv[])
{
cout<<"Enter first numder a = ";
cin>>a;
cout<<"Enter second numder b = ";
cin>>b;
if (a==b) cout<<"a = b = "<<a<<endl;
else if (a==0 || b==0) exit();
else
{
& Find_max(a,b);
& cout<<"Max = "<<Max<<endl;
}
system("PAUSE");
return EXIT_SUCCESS;
}

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
APPROVED BY CLIENTS