Chapter 11 Exercise Set 1¶
Make a file named
swaps.cpp
that includes all three versions of swap functions presented in the chapter with calling code inmain
. Compile and then run your program several times, observing what happens.Write a function named
shuffle
, that takes an array as an argument and randomly “shuffles” the elements in the array. You can create two versions of this function, one that is a modifier and one that is a pure function.Write a function named
str_len
that takes a C string as an argument and returns the number of characters in the string.