CS211 Lab 5
Due Tuesday, September 26
Finish each of the functions in lab5_start.cpp. These each require a loop, and will let you practice array manipulation. Note that the array is passed by reference, so any changes you make to the array will affect the arrays declared in main. This is needed with the reverse function.
Here's an example of what my solution prints when run:
seth@nimrod:~/cs211 $ g++ lab5solution.cpp
seth@nimrod:~/cs211 $ ./a.out
3 6 9 12 15
83 86 77 15 93 35
Array one max: 15
Array two max: 93
Array one is ordered
Array two is NOT ordered
Array one, reversed: 15 12 9 6 3
Array two, first 4 numbers reversed: 15 77 86 83 93 35
The random array may have more consistency than you expect, because this program does not seed the random number generator. If you want, you can seed it with srandom, but will need an int, and you'll need something that changes for that. time(0) will return an integer holding the number of seconds since the beginning of 1970.
Upload both programs to isoptera as with previous labs.