Archiving a bunch of old stuff
This commit is contained in:
1
oldstuff/d/prog-lang-book/.gitignore
vendored
Normal file
1
oldstuff/d/prog-lang-book/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
/bin/*
|
9
oldstuff/d/prog-lang-book/Makefile
Normal file
9
oldstuff/d/prog-lang-book/Makefile
Normal file
@@ -0,0 +1,9 @@
|
||||
ALL_SOURCES := $(shell find src -name '*.d')
|
||||
ALL_TARGETS := $(patsubst src/%.d,bin/%,$(ALL_SOURCES))
|
||||
|
||||
bin/%: src/%.d
|
||||
dmd $^ -of$@
|
||||
|
||||
all: $(ALL_TARGETS)
|
||||
|
||||
.PHONY: all
|
0
oldstuff/d/prog-lang-book/bin/.gitkeep
Normal file
0
oldstuff/d/prog-lang-book/bin/.gitkeep
Normal file
19
oldstuff/d/prog-lang-book/src/height_conversions.d
Normal file
19
oldstuff/d/prog-lang-book/src/height_conversions.d
Normal 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) {
|
||||
writefln("%s'%s''\t%s", feet, inches,
|
||||
(feet * inchesPerFoot + inches) * cmPerInch);
|
||||
}
|
||||
}
|
||||
}
|
5
oldstuff/d/prog-lang-book/src/hello.d
Executable file
5
oldstuff/d/prog-lang-book/src/hello.d
Executable file
@@ -0,0 +1,5 @@
|
||||
#!/usr/bin/env rdmd
|
||||
import std.stdio;
|
||||
void main() {
|
||||
writeln("Hello, world!");
|
||||
}
|
Reference in New Issue
Block a user