Programe in Pascal

2x puncte

categorie: Informatica

nota: 8.05

nivel: Liceu

Acest referat la informatica este alcatuit din 32 de programe efectuate in Pascal. O secventa de cod arata in felul urmator :
Program1;
var f,g:text;
v:array[1..50] of integer;
n,x,i,nr,j,aux:integer;
begin
assign(f,'intrare.txt');
assign(g,'iesire.txt');
reset(f);
read(f,x);
n:=1;
v[n]:=x;
while not eof(f)[...]
DOWNLOAD REFERAT

Preview referat: Programe in Pascal

Acest referat la informatica este alcatuit din 32 de programe efectuate in Pascal. O secventa de cod arata in felul urmator :
Program1;
var f,g:text;
v:array[1..50] of integer;
n,x,i,nr,j,aux:integer;
begin
assign(f,'intrare.txt');
assign(g,'iesire.txt');
reset(f);
read(f,x);
n:=1;
v[n]:=x;
while not eof(f) do
begin
read(f,x);
nr:=0;
for i:=1 to n do
if x=v[i] then inc(nr);
if nr=0 then begin
inc(n);
v[n]:=x;
end;
end;
close(f);
for i:=1 to n-1 do
for j:=i+1 to n do
if v[i]>v[j] then begin
aux:=v[i];
v[i]:=v[j];
v[j]:=aux;
end;
rewrite(g);
writeln(g,n);
for i:=1 to n do write( g,v[i],' ');
close(g);
writeln;
end.

Program8;
var a:array[1..50] of string;
st:array[1..50] of integer;
s,f,k,i:integer;

procedure tipar(k:integer);
var i:integer;
begin
for i:=1 to k do write(a[st[i]],' ');
writeln;
end;
function valid(k:integer):boolean;
var i:integer;
begin
valid:=true;
if (st[k-1]>=st[k]) and (k>1) then
begin
valid:=false;
exit;
end;
end;
procedure back;
begin
k:=1;
st[1]:=0;
repeat
while st[k] begin
inc(st[k]);
if valid(k) then
if k=f then tipar(k)
else begin
inc(k);
st[k]:=0;
end;
end;
dec(k);
until k=0;
end;
begin
write('s=');readln(s);write('f=');readln(f);
for i:=1 to s do
begin
write('dati numele florii ',i,':');
readln(a[i]);
end;
back;
readln;
end.

« mai multe referate din Informatica

CAUTA REFERAT


TRIMITE REFERAT CERE REFERAT
Referatele si lucrarile oferite de E-referate.ro au scop educativ si orientativ pentru cercetare academica.