1234567891011121314151617181920212223242526 |
- import std.stdio : writeln, stdin;
- import std.exception : enforce;
- import stats;
- void main(string[] args)
- {
- Stat[] stats;
- foreach (arg; args[1 .. $])
- {
- auto newStat = cast(Stat) Object.factory("stats." ~ arg);
- enforce(newStat, "Invalid statistics function: " ~ arg);
- stats ~= newStat;
- }
- for (double x; stdin.readf(" %s ", &x) == 1;)
- {
- foreach (s; stats)
- {
- s.accumulate(x);
- }
- }
- foreach (s; stats)
- {
- s.postprocess();
- writeln(s.result());
- }
- }
|