Advertisement
PnnK

Untitled

Dec 22nd, 2021
501
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 0.67 KB | None | 0 0
  1. type
  2.     Patient = record
  3.       surname : string[50];
  4.       sex : string[3];
  5.       age : integer;
  6.       town : string[50];
  7.       diag : string[50];
  8.     constructor Create(sur, sex, town, diag : string; age : integer);
  9.     begin
  10.       self.surname := sur;
  11.       self.sex := sex;
  12.       self.town := town;
  13.       self.diag := diag;
  14.       self.age := age;
  15.     end;
  16.     end;
  17. begin
  18.   var f : file of Patient;
  19.   Rewrite(f, 'D:/patients.data');
  20.   for var i := 0 to 2 do
  21.     begin
  22.       var p := new Patient('Петров', 'М', 'РнД', 'asd', 12);
  23.       f.Write(p);
  24.     end;
  25.   Close(f);
  26.   Reset(f, 'D:/patients.data');
  27.   var x : Patient;
  28.   read(f,x);
  29.   print(x);
  30. end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement