Given four integer numbers, please rearrange the value of them in increasing order.
Hint: You may design a function:
|
void cmp_and_swap(int *first, int *second){ /* if the first element is not smaller than the second one, swap the first and second ones . */ } |
Then call cmp_and_swap() in reorder(int* n1, int* n2, int* n3, int* n4);
The input has four integer numbers num1, num2, num3, and num4.
Print num1, num2, num3, num4 sequentially, and the output should be in increasing order.