home *** CD-ROM | disk | FTP | other *** search
- Program Master;
-
- Uses
- CRT;
-
- Const
- FileName = 'F:\DATA.DAT';
-
- Type
- arType = Array [1..5] of Word;
-
- Var
- f : File Of arType;
- a : arType;
- ioErr : Word;
-
- Begin
- FillChar ( a, SizeOf ( a ), 0 ); { Initialize the array to 0 }
- Assign ( f, FileName );
- Rewrite ( f ); { Create a brand new file }
- Close ( f );
- FileMode := 34; { Access read/write - deny write }
- Reset ( f ); { Open the file }
- Repeat
- Seek ( f, 0 ); { Move to beginning of file }
- Inc ( a[1] ); { Change the values }
- If ( a[1] mod 2 = 0 ) Then
- Inc ( a[2] ); { " }
- If ( a[1] mod 3 = 0 ) Then
- Inc ( a[3] ); { " }
- If ( a[1] mod 4 = 0 ) Then
- Inc ( a[4] ); { " }
- If ( a[1] mod 5 = 0 ) Then
- Inc ( a[5] ); { " }
- Write ( f, a ); { Write to the file }
- WriteLn ( a[1]:4, a[2]:4, a[3]:4, a[4]:4, a[5]:4 );
- Delay ( 1000 ); { Slow down the file updating }
- Until KeyPressed; { Stop if user input }
- Close ( f ); { Close the file }
- End.
-