Home > Back-end >  The maximum value of the three Numbers with function, the minimum value, median, and sorted
The maximum value of the three Numbers with function, the minimum value, median, and sorted

Time:09-15

Why run results is not the correct number and two random Numbers, and bosses guidance solutions

CodePudding user response:

Or you just paste the code! Why we write the code again

CodePudding user response:

I wrote a program, the code is as follows:
 
#include
using namespace std;

Int main () {
Int a, b, c;
Int qmax (int a, b int, int) c;
Int qmin (int a, b int, int) c;
The scanf (" % d % d % d ", & amp; A, & amp; B, & amp; C);
Int Max=qmax (a, b, c);
Int min=qmin (a, b, c);
Int mid=a + b + c - (Max + min);
Printf (" maximum value for: % d, median: % d, minimum value is: % d \ n ", Max, mid, min);
Printf (" sorted: \ n ");
Printf (" % d % d % d \ n ", Max, mid, min);
return 0;
}
Int qmax (int a, b int, int) c {
Int Max;
Max=(a> B)? (a> C? A: c) : (b> C? B, c);
The return of Max;
}
Int qmin (int d, int e, int f) {
Int min;
Min=(dReturn min;
}

The result of the running as shown in figure:

You are so there is no problem

CodePudding user response:

This is the only the tip of direct sort:
 
#include

Void the sort (int & amp; A, int & amp; B, int & amp; C)
{
If (b & gt; C) c +=b=c, b=c - b;
If (a & gt; B) b +=a=b, a=b - a;
If (b & gt; C) c +=b=c, b=c - b;
}

Int main ()
{
Int a, b, c;

Puts (" enter 3 Numbers: ");
The scanf (" % d % d % d ", & amp; A, & amp; B, & amp; C);
Sort (a, b, c);
Printf (" Max=% d, min=% d, median=% d \ n ", c, a, b);

return 0;
}

CodePudding user response:

refer to the second floor Yuan Jun yuan response:
I wrote the program, the code is as follows:
 
#include
using namespace std;

Int main () {
Int a, b, c;
Int qmax (int a, b int, int) c;
Int qmin (int a, b int, int) c;
The scanf (" % d % d % d ", & amp; A, & amp; B, & amp; C);
Int Max=qmax (a, b, c);
Int min=qmin (a, b, c);
Int mid=a + b + c - (Max + min);
Printf (" maximum value for: % d, median: % d, minimum value is: % d \ n ", Max, mid, min);
Printf (" sorted: \ n ");
Printf (" % d % d % d \ n ", Max, mid, min);
return 0;
}
Int qmax (int a, b int, int) c {
Int Max;
Max=(a> B)? (a> C? A: c) : (b> C? B, c);
The return of Max;
}
Int qmin (int d, int e, int f) {
Int min;
Min=(dReturn min;
}

The result of the running as shown in figure:

Your program so there is no problem

#include
Int main ()
{
Int x, y, z, Max, middle, min;
Int qmax (int a, b int, int) c;
Int qmin (int a, b int, int) c;
Printf (" please enter the three Numbers: ");
The scanf (" % d, % d, % d ", & amp; X, & amp; Y, & amp; Z);
Max=qmax (x, y, z);
Min=qmin (x, y, z);
Middle=(x + y + z) - (Max + min);
Printf (" maximum=% d, the median=% d, minimum value=% d \ n ", Max, middle, min);
printf("\n");
Sorting: printf (" % d, % d, % d ", Max, middle, min);
return 0;
}
Int qmax (int a, b int, int) c
{
Int Max;
Max=(a> B)? (a> C? A: c) : (b> C? B, c);
The return of Max;
}
Int qmin (int d, int e, int f)
{
Int min;
Min=(dReturn min;
}

CodePudding user response:

reference 4 floor weixin_42485719 response:
Quote: refer to the second floor Yuan Jun yuan response:
I wrote the program, the code is as follows:
 
#include
using namespace std;

Int main () {
Int a, b, c;
Int qmax (int a, b int, int) c;
Int qmin (int a, b int, int) c;
The scanf (" % d % d % d ", & amp; A, & amp; B, & amp; C);
Int Max=qmax (a, b, c);
Int min=qmin (a, b, c);
Int mid=a + b + c - (Max + min);
Printf (" maximum value for: % d, median: % d, minimum value is: % d \ n ", Max, mid, min);
Printf (" sorted: \ n ");
Printf (" % d % d % d \ n ", Max, mid, min);
return 0;
}
Int qmax (int a, b int, int) c {
Int Max;
Max=(a> B)? (a> C? A: c) : (b> C? B, c);
The return of Max;
}
Int qmin (int d, int e, int f) {
Int min;
Min=(dReturn min;
}

The result of the running as shown in figure:

Your program so there is no problem

#include
Int main ()
{
Int x, y, z, Max, middle, min;
Int qmax (int a, b int, int) c;
Int qmin (int a, b int, int) c;
Printf (" please enter the three Numbers: ");
The scanf (" % d, % d, % d ", & amp; X, & amp; Y, & amp; Z);
Max=qmax (x, y, z);
Min=qmin (x, y, z);
Middle=(x + y + z) - (Max + min);
Printf (" maximum=% d, the median=% d, minimum value=% d \ n ", Max, middle, min);
printf("\n");
Sorting: printf (" % d, % d, % d ", Max, middle, min);
return 0;
}
Int qmax (int a, b int, int) c
{
Int Max;
Max=(a> B)? (a> C? A: c) : (b> C? B, c);
The return of Max;
}
nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  • Related