Sunday, 12 February 2023

Chapter 26 // Drill 3 - Principles & Practice Using C++

In this exercise I'm using Visual Studio 2019 and a modified version of the std_lib_facilities header found here.

Chapter 26 // Drill 3

Based on section 26.3.1.3, complete a program that generates
a. A very large sequence (what would you consider very large, and why?)
b. Ten sequences with a random number of elements.
c. Ten sequences with 0, 1, 2 ... 9 random elements (but still ordered).

I used the sample function from p1000 to create all the tests and wrote them out to a text file. I was surprised that all of my tests failed. I then realised that in his make_test function, he starts the value to search from is n which is an argument parameter (the one we pass in to determine the size of the sequence). So I changed the function up a bit. Another gotcha from Bjarne. 

No comments:

Post a Comment