Skip to content

Commit 7098375

Browse files
committed
Add Pascal examples
1 parent c66dd3f commit 7098375

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

Pascal/1-record.dat

26 Bytes
Binary file not shown.

Pascal/1-record.pas

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
program Example;
2+
3+
type TDate = record
4+
Year: integer;
5+
Month: 1..12;
6+
Day: 1..31;
7+
end;
8+
9+
type TPerson = record
10+
Name: string[10];
11+
City: string[10];
12+
Born: TDate;
13+
end;
14+
15+
var
16+
P1: TPerson;
17+
FPerson: File of TPerson;
18+
19+
begin
20+
P1.Name := 'Marcus';
21+
P1.City := 'Roma';
22+
P1.Born.Day := 26;
23+
P1.Born.Month := 4;
24+
P1.Born.Year := 121;
25+
WriteLn('Name: ', P1.Name);
26+
WriteLn('City: ', P1.City);
27+
WriteLn('Born: ', P1.Born.Year, '-', P1.Born.Month, '-', P1.Born.Day);
28+
Assign(FPerson, './1-record.dat');
29+
Rewrite(FPerson);
30+
Write(FPerson, P1);
31+
Close(FPerson);
32+
end.

0 commit comments

Comments
 (0)