Advertisement
Valik888

pr8

Mar 10th, 2015
187
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 3.21 KB | None | 0 0
  1. program pr8_1;
  2. type
  3.  dayType = record
  4.         day:1..31;
  5.         mounth:1..12;
  6.         year:1..2100;
  7.  end;
  8.  adresType = record
  9.         town:string;
  10.         street:string;
  11.         house:integer;
  12.  end;
  13.  petType = record
  14.         age:1..100;
  15.         name:String;
  16.         count:1..100;
  17.         color:(blue, red, aqua, green, ginger);
  18.  
  19.  end;
  20.  friend = record
  21.         f_n:string;
  22.         l_n:string;
  23.         age:0..100;
  24.         hobby:string;
  25.         birthday:dayType;
  26.         adres:adresType;
  27.         case havePet:(cat, dog, fish) of
  28.                 cat:(haveCat:petType);
  29.                 dog:(haveDog:petType);
  30.                 fish:(haveFish:petType);
  31.  end;
  32. var
  33.         student1, student2:friend;
  34. BEGIN
  35. with student1 do begin
  36.         f_n:='Valentine';
  37.         l_n:='Nosikov';
  38.         age:=17;
  39.         hobby:='Music, bycycle, readln';
  40.         havePet:=cat;
  41.         with haveCat do begin
  42.                 age:=2;
  43.                 name:='Anfisa';
  44.                 count:=1;
  45.                 color:=ginger;
  46.         end;
  47.         with birthday do begin
  48.                 day:=14;
  49.                 mounth:=2;
  50.                 year:=1998;
  51.         end;
  52.         with adres do begin
  53.                 town:='Odesa';
  54.                 street:='Dobrovolskogo';
  55.                 house:=154;
  56.         end;
  57.  
  58. end;
  59. with student2 do begin
  60.         f_n:='Fred';
  61.         l_n:='Mercury';
  62.         age:=45;
  63.         hobby:='Music, bycycle, computer science';
  64.         havePet:=fish;
  65.         with haveFish do begin
  66.                 name:='none';
  67.                 age:=1;
  68.                 count:=11;
  69.                 color:=aqua;
  70.  
  71.         end;
  72.         with birthday do begin
  73.                 day:=5;
  74.                 mounth:=9;
  75.                 year:=1946;
  76.         end;
  77.         with adres do begin
  78.                 town:='Zanzibar';
  79.                 street:='Stone town';
  80.                 house:=1;
  81.         end;
  82. end;
  83. with student1 do begin
  84.         writeln('First name: ', f_n);
  85.         writeln('Last name: ', l_n);
  86.         writeln('Age: ', age);
  87.         writeln('Hobby: ', hobby);
  88.         with birthday do begin
  89.                 writeln('Birthday: ', day, '.', mounth, '.', year);
  90.         end;
  91.         with adres do begin
  92.                 writeln('Town: ', town);
  93.                 writeln('Street: ', street);
  94.                 writeln('House: ', house);
  95.         end;
  96.         with haveCat do begin
  97.                 writeln('Cat name: ', name);
  98.                 writeln('Cat age: ', age);
  99.                 writeln('Cat color: ', color);
  100.         end;
  101. end;
  102. writeln('');
  103. with student2 do begin
  104.         writeln('First name: ', f_n);
  105.         writeln('Last name: ', l_n);
  106.         writeln('Age: ', age);
  107.         writeln('Hobby: ', hobby);
  108.         with birthday do begin
  109.                 writeln('Birthday: ', day, '.', mounth, '.', year);
  110.         end;
  111.         with adres do begin
  112.                 writeln('Town: ', town);
  113.                 writeln('Street: ', street);
  114.                 writeln('House: ', house);
  115.         end;
  116.         with haveFish do begin
  117.                 writeln('Fish color: ', color);
  118.                 writeln('Fish count: ', count);
  119.                 writeln('Fish age: ', age);
  120.         end;
  121. end;
  122. read(student1.birthday.day);
  123. END.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement