Sort three P32954


Statement
 

pdf   zip   main.cc

thehtml

Write a procedure

void sort3(int& a, int& b, int& c);

to sort a, b and c in nondecreasing order. For instance, if called with a =7, b = −3 and c = 1, the values after the call must be a =−3, b = 1 and c = 7.

Observation You only need to submit the required procedure; your main program will be ignored.

Public test cases
  • Input/Output

    sort3(7, -3, 1) → -3 1 7
    sort3(2, 1, 0) → 0 1 2
    sort3(23, 23, 23) → 23 23 23
  • Information
    Author
    Salvador Roura
    Language
    English
    Translator
    Salvador Roura
    Original language
    Catalan
    Other languages
    Catalan
    Official solutions
    C++
    User solutions
    C++