home *** CD-ROM | disk | FTP | other *** search
-
-
- __________________________________________________________________________________
-
- !{ PASCAL Program : pas-exam.spe !
-
- ! Date written : 3-3-86 !
-
- ! Author : Ortolf !
-
- ! Structogram saved on disk : Spe110 !
-
- ! Pascalsource saved on disk : Pas52 !
-
- ! !
-
- ! * main program !
-
- !} !
-
- ! program pasbsp1 (input, output); !
- _______________________________________________________________________________
-
- ! ! const !
- ____________________________________________________________________________
-
- ! ! ! t1 = 'Program Name: pas-exam.spe.'; !
-
- ! ! ! t2 = 'Create file (1), display file (2)? '; !
- ____________________________________________________________________________
-
- ! ! !
- _______________________________________________________________________________
-
- ! ! var !
- ____________________________________________________________________________
-
- ! ! ! zchen : char; !
- ____________________________________________________________________________
-
- ! ! !
- _______________________________________________________________________________
-
- ! ! !
- ____________________________________________________________________________
-
- ! ! !{ !
-
- ! ! ! * subroutine !
-
- ! ! !} !
-
- ! ! ! procedure zweite; !
- _________________________________________________________________________
-
- ! ! ! ! const !
- ______________________________________________________________________
-
- ! ! ! ! ! t3 = 'Display another record (y/n)? '; !
- ______________________________________________________________________
-
- ! ! ! ! !
- _________________________________________________________________________
-
- ! ! ! ! var !
- ______________________________________________________________________
-
- ! ! ! ! ! eins : string (80); !
-
- ! ! ! ! ! zchen : char; !
-
- ! ! ! ! ! ein : text; !
-
- ! ! ! ! ! a : integer; !
- ______________________________________________________________________
-
- ! ! ! ! !
- _________________________________________________________________________
-
- ! ! ! !
- ____________________________________________________________________________
-
- ! ! ! begin !
-
- ! ! ! assign (ein, 'pasbsp1.dat'); !
-
- ! ! ! reset (ein); !
-
- ! ! ! a := 1; { initiate condition } !
- ____________________________________________________________________________
-
- ! ! !{ conditioned loop !
-
- ! ! ! while a = 1 loop } !
-
- ! ! ! while a = 1 do !
- _________________________________________________________________________
-
- ! ! ! !{ reading sucessful } !
-
- ! ! ! ! if (eof(ein)) !
- _________________________________________________________________________
-
- ! ! ! !{ EOF } ! readln (ein, eins); { read record } !
-
- ! ! ! ! EXIT ! writeln (eins); { display record } !
-
- ! ! ! ! ! writeln (t3); !
-
- ! ! ! ! ! readln (zchen); !
- ___________________________________________________________
-
- ! ! ! ! !{ another record? } !
-
- ! ! ! ! ! if (zchen = 'y') !
- ___________________________________________________________
-
- ! ! ! ! !{ yes } !{ no } !
-
- ! ! ! ! ! ! a := 0; !
- ____________________________________________________________________________
-
- ! ! ! close (ein) !
-
- ! ! ! end; !
- ____________________________________________________________________________
-
- ! ! !
- _______________________________________________________________________________
-
- ! ! !
- ____________________________________________________________________________
-
- ! ! !{ !
-
- ! ! ! * subroutine !
-
- ! ! !} !
-
- ! ! ! procedure pasbsp; !
- _________________________________________________________________________
-
- ! ! ! ! const !
- ______________________________________________________________________
-
- ! ! ! ! ! t3 = 'How many record are to be written? '; !
- ______________________________________________________________________
-
- ! ! ! ! !
- _________________________________________________________________________
-
- ! ! ! ! var !
- ______________________________________________________________________
-
- ! ! ! ! ! auss : string (80); !
-
- ! ! ! ! ! zaehl : integer; !
-
- ! ! ! ! ! anzahl : integer; !
-
- ! ! ! ! ! aus : text; !
- ______________________________________________________________________
-
- ! ! ! ! !
- _________________________________________________________________________
-
- ! ! ! !
- ____________________________________________________________________________
-
- ! ! ! begin !
-
- ! ! !{ case 1 !
-
- ! ! ! create file } !
-
- ! ! ! assign (aus, 'pasbsp1.dat'); !
-
- ! ! ! rewrite (aus); !
-
- ! ! ! writeln (t3); { input number of records } !
-
- ! ! ! readln (anzahl); !
- ____________________________________________________________________________
-
- ! ! ! for zaehl := 1 to anzahl do !
-
- ! ! !{ indexed loop } !
- _________________________________________________________________________
-
- ! ! ! ! readln (auss); { input record } !
-
- ! ! ! ! writeln (auss); { display record } !
-
- ! ! ! ! writeln (aus, auss); { write record } !
- ____________________________________________________________________________
-
- ! ! ! close (aus); !
-
- ! ! ! end; !
- ____________________________________________________________________________
-
- ! ! !
- _______________________________________________________________________________
-
- ! !
- __________________________________________________________________________________
-
- ! begin !
-
- ! writeln (t1); !
-
- !{ an unconditioned loop is !
-
- ! following } !
- __________________________________________________________________________________
-
- ! !
- _______________________________________________________________________________
-
- ! ! writeln (t2); !
-
- ! ! readln (zchen); !
- _______________________________________________________________________________
-
- ! !{ case } !
-
- ! ! if (zchen = !
- _______________________________________________________________________________
-
- ! ! '1') ! '2') !{ else-case !
- ___________________________________________________________
-
- ! !{ case 1 } !{ case 2 } ! end } !
-
- ! ! pasbsp { create file } ! zweite { display file } ! EXIT !
- __________________________________________________________________________________
-
- ! end. !
- __________________________________________________________________________________
-
- 14.06.1987 14.06.1987 0001000F
-