- 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
struct
for a data structure- here's a link to discuss the diff between
class
andstruct
: Function for C++ struct
- here's a link to discuss the diff between
- you'd better use
scoped enumeration
instead of usingplain enumeration
, which means:enum class
is better thanenum
declaration
- code like below,
static
will letdd
created only once:
const Date& default_date() {
static Date dd{Year{2001}, Month::jan, 1};
return dd;
}