home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / PASCAL / RFORM.ZIP / _RFORM.DOC next >
Encoding:
Text File  |  1988-01-06  |  3.7 KB  |  66 lines

  1. (*****************************************************************************)
  2. (* _RFORM.PAS is a Turbo 4.0 unit to mimic the form funuction of Turbo 3.x.  *)
  3. (* The underline in the name is a convention I've started to separate my unit*)
  4. (* files from everything else.                                               *)
  5. (*                                                                           *)
  6. (* _RFORM follows the numeric formating conventions of 3.0 except for        *)
  7. (* two items.                                                                *)
  8. (*                                                                           *)
  9. (*     1. A decimal '.' is the only way to define the decimal position in    *)
  10. (*          a real. Trailing decimal points are suppressed. I just spent     *)
  11. (*          to much time taking them off under 3.0.                          *)
  12. (*                                                                           *)
  13. (*      2. Stand alone '.' and ',' are not mistaken for start of a field.    *)
  14. (*                                                                           *)
  15. (* Although written for a real input the parameter type, the 4.0 automatic   *)
  16. (*   type conversion allows you to pass any numeric type to the procedure.   *)
  17. (*                                                                           *)
  18. (* function Form(Picture : string;         {Takes Real,Integer}              *)
  19. (*               R       : real) : string; {LongInt,Word,Byte}               *)
  20. (*                                                                           *)
  21. (* Where a Picture can be a string such as:                                  *)
  22. (*                                                                           *)
  23. (* 'This is a picture of a real number @##,###.## with ''0'' left fill'      *)
  24. (* 'This is a picture of a real number *##,###.## with ''*'' left fill'      *)
  25. (* 'This is a picture *$#,###.## with ''*'' left fill and floating $'        *)
  26. (* 'This is a picture +###,###.## with a leading sign character'             *)
  27. (* 'This is a picture ###,###.##- with a trailing sign character'            *)
  28. (*                                                                           *)
  29. (*****************************************************************************)
  30.  
  31. program _RFORM_DEMO;
  32.  
  33. uses crt,_RFORM;
  34.  
  35. var C : char;
  36.  
  37. begin
  38.   clrscr;
  39.   writeln('Form Demo');
  40.   writeln('@##,###.##  This is a picture of a real number  with ''0'' left fill');
  41.   writeln(form('@##,###.## "0" left fill',pi*100));
  42.   writeln;
  43.   writeln('*##,###.## This is a picture of a real number  with ''*'' left fill');
  44.   writeln(form('*##,###.## "*" left fill.',pi*1000));
  45.   writeln;
  46.   writeln('*$#,###.## This is a picture  with ''*'' left fill and floating $');
  47.   writeln(form('*$#,###.## "*" left fill and floating "$"',pi*100));
  48.   writeln;
  49.   writeln('+###,###.## This is a picture  with a leading sign character');
  50.   writeln(form('+###,###.## leading sign character.',pi*10000));
  51.   writeln;
  52.   writeln('+###,###.## This is a picture  with a leading sign character and * fill.');
  53.   writeln(form('+##*,###.## leading sign character and "*" fill.',pi*1000));
  54.   writeln;
  55.   writeln('###,###.##- This is a picture  with a trailing sign character');
  56.   writeln(form('###,###.##- trailing sign character.',-pi*10000));
  57.   writeln;
  58.   writeln('###,###. This is a Picture with trailing decimal suppression');
  59.   writeln(form('###,###. trailing decimal suppression.',-pi*10000));
  60.   writeln;
  61.   writeln('###,### Or no decimal and the comma is not mistaken for a decimal.');
  62.   writeln(form('###,### No decimal.',-pi*10000));
  63.   write('Press any key . . . ');
  64.   C:=ReadKey;
  65.   clrscr;
  66. end.