Add some comments.
This commit is contained in:
parent
d569d86790
commit
16ca18d8d1
1 changed files with 6 additions and 1 deletions
|
|
@ -11,9 +11,12 @@ const double internalInjuries = 25.0;
|
|||
const double fatal = 40.0;
|
||||
const double puree = 100.0;
|
||||
|
||||
const Acceleration g = 9.8 * metre / second /second; // about 35.3 km/h/s
|
||||
const Acceleration g = 9.8 * metre / second / second; // about 35.3 km/h/s
|
||||
const Mass typicalHuman = 80 * kilogram;
|
||||
|
||||
/++
|
||||
+ Prompt the user for a plausible number from stdin.
|
||||
+/
|
||||
double getVelocity() {
|
||||
string v = "";
|
||||
while (!isNumeric(v)) {
|
||||
|
|
@ -24,6 +27,7 @@ double getVelocity() {
|
|||
}
|
||||
|
||||
void main(string[] argv) {
|
||||
// Fetch a number from a cli argument, or prompt for one from stdin.
|
||||
double velocity = 0;
|
||||
auto args = getopt(argv,
|
||||
"velocity|v", "How fast The Flash was going", &velocity
|
||||
|
|
@ -43,6 +47,7 @@ void main(string[] argv) {
|
|||
Force f = typicalHuman * a;
|
||||
double accel_g = a / g;
|
||||
|
||||
// Output some opinionated results.
|
||||
writefln("The Flash goes from stand-still to %s in a tenth of a second, thus accelerating at %.1f g.", "%.0f km/h".siFormat(v), accel_g);
|
||||
writefln("This would exert a force of %s on a typical human body.", "%.1f kN".siFormat(f));
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue