spege1te.pas 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. program spege1te;
  2. uses
  3. typ,
  4. spe;
  5. const
  6. fspe: array[1..20] of rfunc1r = (@speach, @spearc, @spears, @speash, @speath, @spebi0, @spebi1, @spebj0, @spebj1, @spebk0, @spebk1, @speby0, @speby1, @specoh, @speefc, @speerf, @spegam, @spelga, @spesih, @spetah);
  7. fnames =
  8. 'speachspearcspearsspeashspeathspebi0spebi1spebj0spebj1spebk0' +
  9. 'spebk1speby0speby1specohspeefcspeerfspegamspelgaspesihspetah';
  10. var
  11. x: ArbFloat;
  12. t, u: ArbInt;
  13. s, h: string;
  14. f: rfunc1r;
  15. begin
  16. s := ParamStr(1);
  17. u := (Pos(s, fnames) + 5) div 6;
  18. if u = 0 then
  19. begin
  20. writeln(s, ' (commandlineparameter 1) bestaat niet in SPE');
  21. halt;
  22. end;
  23. f := fspe[u];
  24. Write('program results ' + s + 'te ');
  25. case SizeOf(ArbFloat) of
  26. 4: writeln('(single)');
  27. 8: writeln('(double)');
  28. 6: writeln('(real)');
  29. end;
  30. x := pi;
  31. Str(x, h);
  32. t := Length(h) - 1;
  33. writeln;
  34. writeln('': t div 2, 'x', '': t - length(s) div 2, s + '(x)');
  35. writeln;
  36. while not EOF do
  37. begin
  38. readln(x);
  39. writeln(x, ' ': 2, f(x));
  40. end;
  41. end.