Copied Code for arrays - Used comments from web-page as example and added some comments.
Compiled and ran code.
For 2-D arrays: How are these lemenst distributed in rows and colums?
The array values are distributed by filling up each row of the array, then when the row is complete, it moves onto the next row
Note: you can, and in some cases should, use braces to specify rows and columns. Fins a simple example on google.
Example: int x[3][4] = {{0,1,2,3}, {4,5,6,7}, {8,9,10,11}};
Source: https://www.geeksforgeeks.org/multidimensional-arrays-c-cpp/
Copied the code for using multiple files to process vectors.
Compiled and ran code.
Copied code for generating random numbers.
Compiled and ran code.
Try removing this and see how the result changes. What does the & do?
The & denotes inew as a reference variable - Having the reference allows the method to access the original value instead of a copy.
"Integers are stored in memory in bytes, each of which contains 8 bits, each of which can have the value 0 or 1. Hence, with n bytes, unsigned data with a value up to 28n-1 can be stored."
Show how we get to this number?
Binary is base 2, which means that with n bits, 2n numbers can be represented, including 0 (1 bit > 0,1; 2 bits > 0, 1, 2, 3; etc...). following that, the highest number that can be represented with n bits is 2n-1. 28n-1 is represented with bytes, which each have 8 bits, so to get bits you need to multiply n by 8, hence the 8n.
Put a cout statement into the code that makes it print the first 10 “random” numbers it generates. Run the executable a couple of times. What do you notice? (This is why they are called pseudo-random numbers.)
Try changing the seed (it should be odd and large). What happens then?
The random numbers printed are always the same and in the same order, because the seed is always constant.
With a new seed, the numbers are different from before, but they are still the same between iterations of the same seed.
Now try changing the number of times you call the random number generator from 1000 to other numbers (say, 10, 100, 100000, etc). What do you notice about the contents of the histogram?
The contents of the histogram even out as the number of iterations increases, showing that for large numbers of iterations the pseudo random number generator is fair.
Copied code for random number generation using strand function.
Edited code for missing #include statement and to better format output.
Compiled and ran code.