In the case of your code, it just happens that the member and parameter have the same name.
Which, incidentally, is something that many programmers avoid, in order to avoid confusion. We usually adopt some kind of naming convention that clearly differentiates between data members and other variables.
In reality there is no need for such a thing as that since you would never have a direct 1-to-1 relationship between your class members and your constructor parameters, so that notation is generally only useful for examples - however this is entirely opinion and based on my experience, it may not reflect your experience.
Well it has other benefits too - you can see at a glance when a variable is part of the state of the object (i.e. a data member), rather than having to check the declaration. It's especially useful when - as is often the case in professional software development - other people will need to be able to read and quickly understand your code at some point in the future.
Ok that makes sense. None of my professors have taught/shown me that kind of constructor before. My current professor tends to just read certain parts from our textbook during class and is always a week ahead. In other words, he's "teaching" us next week's subject while we're still trying to figure out last week's project.
Comma operator is different than comma in math you are basically just multiplying by 1 and not 1 million. Also you are doing integer division which results in an integer. I would suggest diff / static_cast<double>( N )diff / (double) N
or define N as a const double instead of integer.
From the various examples on this site, this should initialize the array with random numbers until the index reaches the size of the array but I'm only getting one element to show with a random number when I debug it. It goes through the for loop like it should and i increments and gets a new random number appointed to that particular index but when I check the array in the debugger, it only shows the first element with it's random number. Am I forgetting something here?
When ever you want to use rand() you should call srand() once to give it a seed. The way to make it look the most random is to use the system clock since it it based on ms from midnight I believe so it would be hard to get the same results twice.
Basically just throw in a srand( time( NULL ) ); In your main function or in the initialize array.