home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / INFO / MISC / SPE.ZIP / PAS-EXAM.PRT < prev    next >
Encoding:
Text File  |  1987-06-14  |  11.6 KB  |  97 lines

  1.                
  2.  
  3. __________________________________________________________________________________
  4.  
  5. !{ PASCAL Program                       : pas-exam.spe                           !
  6.  
  7. !  Date written                         : 3-3-86                                 !
  8.  
  9. !  Author                               : Ortolf                                 !
  10.  
  11. !  Structogram  saved on disk           : Spe110                                 !
  12.  
  13. !  Pascalsource saved on disk           : Pas52                                  !
  14.  
  15. !                                                                                !
  16.  
  17. ! *                                                         main program         !
  18.  
  19. !}                                                                               !
  20.  
  21. ! program pasbsp1 (input, output);                                               !
  22.    _______________________________________________________________________________
  23.  
  24. !  ! const                                                                       !
  25.       ____________________________________________________________________________
  26.  
  27. !  !  ! t1 = 'Program Name: pas-exam.spe.';                                      !
  28.  
  29. !  !  ! t2 = 'Create file (1), display file (2)? ';                              !
  30.       ____________________________________________________________________________
  31.  
  32. !  !                                                                             !
  33.    _______________________________________________________________________________
  34.  
  35. !  ! var                                                                         !
  36.       ____________________________________________________________________________
  37.  
  38. !  !  ! zchen : char;                                                            !
  39.       ____________________________________________________________________________
  40.  
  41. !  !                                                                             !
  42.    _______________________________________________________________________________
  43.  
  44. !  !                                                                             !
  45.       ____________________________________________________________________________
  46.  
  47. !  !  !{                                                                         !
  48.  
  49. !  !  ! *                                                   subroutine           !
  50.  
  51. !  !  !}                                                                         !
  52.  
  53. !  !  ! procedure zweite;                                                        !
  54.          _________________________________________________________________________
  55.  
  56. !  !  !  ! const                                                                 !
  57.             ______________________________________________________________________
  58.  
  59. !  !  !  !  ! t3 = 'Display another record (y/n)? ';                             !
  60.             ______________________________________________________________________
  61.  
  62. !  !  !  !                                                                       !
  63.          _________________________________________________________________________
  64.  
  65. !  !  !  ! var                                                                   !
  66.             ______________________________________________________________________
  67.  
  68. !  !  !  !  ! eins  : string (80);                                               !
  69.  
  70. !  !  !  !  ! zchen : char;                                                      !
  71.  
  72. !  !  !  !  ! ein   : text;                                                      !
  73.  
  74. !  !  !  !  ! a     : integer;                                                   !
  75.             ______________________________________________________________________
  76.  
  77. !  !  !  !                                                                       !
  78.          _________________________________________________________________________
  79.  
  80. !  !  !                                                                          !
  81.       ____________________________________________________________________________
  82.  
  83. !  !  !  begin                                                                   !
  84.  
  85. !  !  !  assign (ein, 'pasbsp1.dat');                                            !
  86.  
  87. !  !  !  reset  (ein);                                                           !
  88.  
  89. !  !  !  a := 1;                                  { initiate condition }         !
  90.       ____________________________________________________________________________
  91.  
  92. !  !  !{                                            conditioned loop             !
  93.  
  94. !  !  !                                             while a = 1 loop }           !
  95.  
  96. !  !  !  while a = 1 do                                                          !
  97.          _________________________________________________________________________
  98.  
  99. !  !  !  !{                                         reading sucessful }          !
  100.  
  101. !  !  !  !  if (eof(ein))                                                        !
  102.          _________________________________________________________________________
  103.  
  104. !  !  !  !{      EOF } !  readln  (ein, eins);    { read record }                !
  105.  
  106. !  !  !  !  EXIT       !  writeln (eins);         { display record }             !
  107.  
  108. !  !  !  !             !  writeln (t3);                                          !
  109.  
  110. !  !  !  !             !  readln (zchen);                                        !
  111.                        ___________________________________________________________
  112.  
  113. !  !  !  !             !{                           another record? }            !
  114.  
  115. !  !  !  !             !  if (zchen = 'y')                                       !
  116.                        ___________________________________________________________
  117.  
  118. !  !  !  !             !{                  yes } !{                    no   }    !
  119.  
  120. !  !  !  !             !                         !  a := 0;                      !
  121.       ____________________________________________________________________________
  122.  
  123. !  !  !  close (ein)                                                             !
  124.  
  125. !  !  !  end;                                                                    !
  126.       ____________________________________________________________________________
  127.  
  128. !  !                                                                             !
  129.    _______________________________________________________________________________
  130.  
  131. !  !                                                                             !
  132.       ____________________________________________________________________________
  133.  
  134. !  !  !{                                                                         !
  135.  
  136. !  !  ! *                                                   subroutine           !
  137.  
  138. !  !  !}                                                                         !
  139.  
  140. !  !  ! procedure pasbsp;                                                        !
  141.          _________________________________________________________________________
  142.  
  143. !  !  !  ! const                                                                 !
  144.             ______________________________________________________________________
  145.  
  146. !  !  !  !  ! t3 = 'How many record are to be written? ';                        !
  147.             ______________________________________________________________________
  148.  
  149. !  !  !  !                                                                       !
  150.          _________________________________________________________________________
  151.  
  152. !  !  !  ! var                                                                   !
  153.             ______________________________________________________________________
  154.  
  155. !  !  !  !  ! auss   : string (80);                                              !
  156.  
  157. !  !  !  !  ! zaehl  : integer;                                                  !
  158.  
  159. !  !  !  !  ! anzahl : integer;                                                  !
  160.  
  161. !  !  !  !  ! aus    : text;                                                     !
  162.             ______________________________________________________________________
  163.  
  164. !  !  !  !                                                                       !
  165.          _________________________________________________________________________
  166.  
  167. !  !  !                                                                          !
  168.       ____________________________________________________________________________
  169.  
  170. !  !  !  begin                                                                   !
  171.  
  172. !  !  !{                                            case 1                       !
  173.  
  174. !  !  !                                             create file }                !
  175.  
  176. !  !  !  assign  (aus, 'pasbsp1.dat');                                           !
  177.  
  178. !  !  !  rewrite (aus);                                                          !
  179.  
  180. !  !  !  writeln (t3);                            { input number of records }    !
  181.  
  182. !  !  !  readln  (anzahl);                                                       !
  183.       ____________________________________________________________________________
  184.  
  185. !  !  !  for zaehl := 1 to anzahl do                                             !
  186.  
  187. !  !  !{                                            indexed loop   }             !
  188.          _________________________________________________________________________
  189.  
  190. !  !  !  !  readln  (auss);                       { input record   }             !
  191.  
  192. !  !  !  !  writeln (auss);                       { display record }             !
  193.  
  194. !  !  !  !  writeln (aus, auss);                  { write record   }             !
  195.       ____________________________________________________________________________
  196.  
  197. !  !  !  close (aus);                                                            !
  198.  
  199. !  !  !  end;                                                                    !
  200.       ____________________________________________________________________________
  201.  
  202. !  !                                                                             !
  203.    _______________________________________________________________________________
  204.  
  205. !                                                                                !
  206. __________________________________________________________________________________
  207.  
  208. ! begin                                                                          !
  209.  
  210. ! writeln (t1);                                                                  !
  211.  
  212. !{                                                  an unconditioned loop is     !
  213.  
  214. !                                                   following }                  !
  215. __________________________________________________________________________________
  216.  
  217. !                                                                                !
  218.    _______________________________________________________________________________
  219.  
  220. !  !  writeln (t2);                                                              !
  221.  
  222. !  !  readln (zchen);                                                            !
  223.    _______________________________________________________________________________
  224.  
  225. !  !{                                               case }                       !
  226.  
  227. !  !  if (zchen =                                                                !
  228.    _______________________________________________________________________________
  229.  
  230. !  !    '1')                     !    '2')                   !{      else-case   !
  231.    ___________________________________________________________
  232.  
  233. !  !{          case 1          } !{          case 2        } !       end       } !
  234.  
  235. !  !  pasbsp { create file     } !  zweite { display file  } !  EXIT             !
  236. __________________________________________________________________________________
  237.  
  238. ! end.                                                                           !
  239. __________________________________________________________________________________
  240.  
  241. 14.06.1987    14.06.1987   0001000F
  242.