Minimum and maximum P98458


Statement
 

pdf   zip   main.cc

html

Write a procedure

void min_max(int a, int b, int& mn, int& mx);

to store in mn the minimum of a and b, and store in mx the maximum of a and b. For instance, if called with a =7 and b = −3, the values after the call must be mn =−3 and mx = 7.

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

Public test cases
  • Input/Output

    min_max(7, -3) → -3 7
    min_max(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++