Introductory STL Exercise
(Note: this exercise uses NanoRange
, a library that implements some
new C++20 facilities. This is purely to make the syntax a bit simpler: all
of these exercises could be done using the standard library as well.)
cppreference.com provides a detailed guide to all the standard library algorithms.
Exercise 1
The function get_words()
from header words.hpp
returns a list of random
English words.
Can you print these out in alphabetical order?
Exercise 2
The function get_random_numbers()
from header random_numbers.hpp
returns
a list of 100 random numbers in the range [1, 1000].
- What are the minimum and maximum values you were given?
- [Harder] what is the median of the values you were given?