Pagini recente » Cod sursa (job #889619) | Cod sursa (job #2812098) | Cod sursa (job #607421) | Cod sursa (job #193357) | Cod sursa (job #420737)
Cod sursa(job #420737)
{
schi.pas
Copyright 2010 Borbath Tamas <[email protected]>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
MA 02110-1301, USA.
}
program schi;
uses crt;
type lista=^listaelem;
listaelem=record
adat:integer;
next:lista;
end;
var f:text;
i,seged,n:integer;
p:lista;
procedure feldolgoz(count,ertek:integer);
var k:integer;
s,se:lista;
begin
s:=p;
for k:=1 to count-1 do s:=s^.next;
new(se);
se^.adat:=ertek;
se^.next:=s^.next;
s^.next:=se;
//writeln(count:5,ertek:5);
end;
procedure kiir(a:lista);
var g:text;
begin
assign(g,'schi.out');
rewrite(g);
//writeln('A kiiratas itt kezdodik!!!');
a:=a^.next;
while a<>nil do
begin
writeln(g,a^.adat);
a:=a^.next;
end;
// writeln('A kiiratas itt er veget!!!');
close(g);
end;
BEGIN
new(p);
p^.adat:=666;
p^.next:=nil;
assign(f,'schi.in');
reset(f);
readln(f,n);
for i:=1 to n do
begin
readln(f,seged);
feldolgoz(seged,i);
end;
kiir(p);
END.