Advertisement
patryk

Tródny program

Nov 14th, 2013
360
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.28 KB | None | 0 0
  1. program Project13;
  2.  
  3. {$APPTYPE CONSOLE}
  4.  
  5. {$R *.res}
  6.  
  7. uses
  8. System.SysUtils;
  9.  
  10. type data = record
  11. dzien: 1..31;
  12. miesiac: 1..12;
  13. rok : Integer;
  14. end;
  15.  
  16. type pracownik = record
  17. imie: String[20];
  18. nazwisko: String[20];
  19. data_ur: data;
  20. end;
  21.  
  22. var t:pracownik;
  23. tab: array[0..9] of pracownik;
  24. TF : TextFile;
  25. S: String;
  26. i, temp:Integer;
  27.  
  28.  
  29. begin
  30. try
  31. t.imie:='Jan';
  32. t.nazwisko:='Kowalski';
  33. t.data_ur.dzien:=4;
  34. t.data_ur.miesiac:=5;
  35. t.data_ur.rok:=1929;
  36.  
  37. i:=0;
  38. temp:=0;
  39.  
  40. AssignFile(TF, 'C:\Documents and Settings\student.LAB-144-13\Pulpit\PP\pracownicy.txt');
  41. Reset(TF);
  42. while Not Eof(TF) do
  43. begin
  44. ReadLn(TF, tab[i].imie);
  45. ReadLn(TF, tab[i].nazwisko);
  46. ReadLn(TF, tab[i].data_ur.dzien);
  47. ReadLn(TF, tab[i].data_ur.miesiac);
  48. ReadLn(TF, tab[i].data_ur.rok);
  49. i:=i+1;
  50. temp:=temp+1;
  51. end;
  52. CloseFile(TF);
  53.  
  54. for i := 0 to temp-1 do
  55. begin
  56. Write(tab[i].imie + ' ');
  57. Write(tab[i].nazwisko + ' ');
  58. Write(tab[i].data_ur.dzien , ' ');
  59. Write(tab[i].data_ur.miesiac , ' ');
  60. WriteLn(tab[i].data_ur.rok , ' ');
  61. end;
  62. ReadLn;
  63. except
  64. on E: Exception do
  65. Writeln(E.ClassName, ': ', E.Message);
  66. end;
  67. end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement