spege1te.pas 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  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.
  42. program spege1te;
  43. uses
  44. typ,
  45. spe;
  46. const
  47. 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);
  48. fnames =
  49. 'speachspearcspearsspeashspeathspebi0spebi1spebj0spebj1spebk0' +
  50. 'spebk1speby0speby1specohspeefcspeerfspegamspelgaspesihspetah';
  51. var
  52. x: ArbFloat;
  53. t, u: ArbInt;
  54. s, h: string;
  55. f: rfunc1r;
  56. begin
  57. s := ParamStr(1);
  58. u := (Pos(s, fnames) + 5) div 6;
  59. if u = 0 then
  60. begin
  61. writeln(s, ' (commandlineparameter 1) bestaat niet in SPE');
  62. halt;
  63. end;
  64. f := fspe[u];
  65. Write('program results ' + s + 'te ');
  66. case SizeOf(ArbFloat) of
  67. 4: writeln('(single)');
  68. 8: writeln('(double)');
  69. 6: writeln('(real)');
  70. end;
  71. x := pi;
  72. Str(x, h);
  73. t := Length(h) - 1;
  74. writeln;
  75. writeln('': t div 2, 'x', '': t - length(s) div 2, s + '(x)');
  76. writeln;
  77. while not EOF do
  78. begin
  79. readln(x);
  80. writeln(x, ' ': 2, f(x));
  81. end;
  82. end.