calculating maximum and minimum values for a basic C++ program
I'm having trouble creating a program that has 4 input values and from that calculating the minimum and maximum values, for example if you had 1, 4, 19, 5, the maximum value for this data set would be 19 and the minimum value would be 1, I'm getting stuck on the if statement, how would I construct a better one including all variables?
This is what I've got so far:
float min, max(float a, b, c, d)
void main ( ) {
cout<<"insert 4 #'s \n";
cin>>a>>b>>c>>d;
if max(a,b,c,d == 1);
cout<<d, "_"<<c, "_" <<b, "_"<<a;
else if max(a, b, c, d) == 2)
cout<<"maximum value";
cout << " \n" ;
cout<<"insert 4#'s \n";
cin>>a>>b>>c>>d;
if min(a, b, c, d ==3)
cout<<a, "_"<<b, "_" <<c, "_"<<d;
else if min(a, b, c, d) == 4)
cout<<d, "_"<<c, "_" <<b, "_"<<a;
else
cout<<"minimum value";
}
what should I do?
:confused: