Doing unit conversion prog, touching up Makefile

This commit is contained in:
Dan Buch 2012-10-17 23:57:27 -04:00
parent 55ce5682e2
commit 8f31e77e96
2 changed files with 22 additions and 1 deletions

View File

@ -4,4 +4,6 @@ ALL_TARGETS := $(patsubst src/%.d,bin/%,$(ALL_SOURCES))
bin/%: src/%.d bin/%: src/%.d
dmd $^ -of$@ dmd $^ -of$@
$(ALL_TARGETS): $(ALL_SOURCES) all: $(ALL_TARGETS)
.PHONY: all

View File

@ -0,0 +1,19 @@
/*
Compute heights in centimeters for a range of heights
expressed in feet and inches
*/
import std.stdio;
void main() {
// Values unlikely to change soon
immutable inchesPerFoot = 12;
immutable cmPerInch = 2.54;
// Loop'n write
foreach (feet; 5 .. 7) {
foreach (inches; 0 .. inchesPerFoot) {
writeln(feet, "'", inches, "''\t",
(feet * inchesPerFoot + inches) * cmPerInch);
}
}
}