GamerSK

pisomecka ?

Jun 5th, 2017
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 1.50 KB | None | 0 0
  1. //Meno, hmotnost, vyska
  2. //pridat
  3. //vypisat
  4. program menohmotnostvyska;
  5. {$APPTYPE CONSOLE}
  6. uses SysUtils;
  7. var m,h,v:text; meno,hmotnost,vyska,hl:string;
  8.     vyskyt:boolean; i:byte;
  9. begin
  10.   { TODO -oUser -cConsole Main : Insert code here }
  11.   assign(m,'meno.txt'); assign(h,'hmotnost.txt'); assign(v,'vyska.txt');
  12.   reset(m); reset(h); reset(v);
  13.   vyskyt:=false;
  14.   writeln('Vypis databazy:');
  15.   while not eof(m) do
  16.     begin
  17.       vyskyt:=true;
  18.       readln(m,meno);
  19.       readln(h,hmotnost);
  20.       readln(v,vyska);
  21.       writeln('  ',meno:5,hmotnost:5,vyska:5);
  22.     end;
  23.   if vyskyt=false then writeln('  V databaze nieje ziadny udaj!');
  24.   close(m); close(h); close(v);
  25.   append(m); append(h); append(v);
  26.   i:=1;
  27.   writeln('Zadavanie ukoncite 0');
  28.   repeat
  29.     write('Zadajte ',i,' meno: ');
  30.     readln(meno);
  31.     if meno='0' then break;
  32.     writeln(m,meno);
  33.     write('Zadajte ',i,' hmotnost: ');
  34.     readln(hmotnost);
  35.     writeln(h,hmotnost);
  36.     write('Zadajte ',i,' vysku: ');
  37.     readln(vyska);
  38.     writeln(v,vyska);
  39.     inc(i);
  40.   until meno='0';
  41.   close(m); close(h); close(v);
  42.   writeln('Vyhladavanie ukoncite 0');
  43.   repeat
  44.     reset(m); reset(h); reset(v);
  45.     write('Zadajte hladane meno: ');
  46.     readln(hl);
  47.     if hl='0' then break;
  48.     while not eof(m) do
  49.       begin
  50.         readln(m,meno);
  51.         readln(h,hmotnost);
  52.         readln(v,vyska);
  53.         if hl=meno then writeln('  ',meno:5,hmotnost:5,vyska:5);
  54.       end;
  55.     close(m); close(h); close(v);
  56.   until hl='0';
  57. end.
Advertisement
Add Comment
Please, Sign In to add comment