Skip to main content
2 of 2
edited body
Madagascar
  • 10.1k
  • 1
  • 16
  • 52

Minus the call to std::cout, you have a program that is all C. So why not use C and a C compiler instead of running almost C code under a C++ compiler?


Martin suggests using constexpr instead of const. Note that you can also do that in C2X. (constexpr can not - yet - be used for functions in C.)


As you're already including <cstdlib>, return EXIT_SUCCESS instead of 0. Or elide it altogether in C++.


In simulate, data is not modified anywhere. So it should be declared with the const qualifier. In C, the compiler might be able to do more optimizations if you use restrict for the parameters.


std::endl flushes the underlying buffer after printing a newline. You do not require that. Replace it with a \n.


In main(), "enteries" should be "entries".

Madagascar
  • 10.1k
  • 1
  • 16
  • 52