- chapter 5 generate_rand_nums() function, use C++11 random library. to find more detail, the following links can be helpful:
- Actually, this is the example that using in my code. Generate random numbers using C++11 random library
- Cpp reference -- Pseudo-random number generation
- Cpp reference -- srand
- chapter 9 mentioned that you can also use
structfor a data structure- here's a link to discuss the diff between
classandstruct: Function for C++ struct
- here's a link to discuss the diff between
- you'd better use
scoped enumerationinstead of usingplain enumeration, which means:enum classis better thanenumdeclaration
- code like below,
staticwill letddcreated only once:
const Date& default_date() {
static Date dd{Year{2001}, Month::jan, 1};
return dd;
}