Skip to main content
Share Your Experience: Take the 2024 Developer Survey
3 votes

Parsing command-line arguments with getopt in C++

Are the calls to std::exit() justifiable? No. Never use std::exit(). ...
indi's user avatar
  • 11.3k
3 votes

A simple ray marcher for the command line

Prefer static inline functions to macros: #define V3(X, Y, Z) (struct vector3d) {.x = X, .y = Y, .z = Z} is better as: ...
Harith's user avatar
  • 6,810
3 votes

rock paper scissors game in console

Math.floor((Math.random() * 100)/40); This will not result in equal probabilities of rock, ...
Raimund Krämer's user avatar
3 votes

Display summary statistics about Discord messages

Yes, as you have indicated, the very first step should be to split your code into dedicated modules. Almost all of your methods are used only once. A very natural split could be to encapsulate those ...
Peter Csala's user avatar
  • 9,134

Only top scored, non community-wiki answers of a minimum length are eligible