
Zasto ne rade programi u delphiu tipa:
Code:
for x:=length(rijec) downto 1 do
begin
Edit1.Text:=rijec[x];
end;
for x:=length(rijec) downto 1 do
begin
Edit1.Text:=rijec[x];
end;
Kako bi trebao izgledat gore onaj dio koda u delphiu koji ce na taj nacin nesto ispisati....?????
Ili opcenito sa prebrojavanjem rijec, znakova napisanih u Edit1.Text.....ili u Memo1
U ovom dolje primjeru varijabla "duz" govori koliko rijeci ima u datoteci, a kako u delphiu prebrojat te rijeci....znaci sve o stringlistu !!!!!!!!!!!!!!!!!
Code:
program rad_sa_datotekom;
uses crt;
var a:text;
x,y,j,duz,vece,manje:integer;
b,t:array [1..100] of string;
max,min:string;
begin
clrscr;
assign(a,'c:\ulaz.txt');
reset(a);
duz:=0;
writeln('NESORTIRANI NIZ:');
while not eof(a) do
begin
inc(duz);
readln(a,b[duz]);
writeln(b[duz]);
end;
close(a);
for x:=duz-1 downto 1 do
for j:=1 to x do
begin
if b[j]>b[j+1] then
begin
t[j]:=b[j];
b[j]:=b[j+1];
b[j+1]:=t[j];
end;
end;
writeln;
writeln;
writeln;
writeln;
writeln('SORTIRANI NIZ:');
for j:=1 to duz do
begin
writeln(j,'.ime:',b[j]);
end;
vece:=0;
for y:=1 to duz do
begin
if length(b[y])>vece then max:=b[y];
end;
assign(a,'c:\izlaz.txt');
rewrite(a);
for j:=1 to duz do
begin
writeln(a,b[j]);
end;
close(a);
writeln;
writeln('U datoteci ulaz.txt najdulja rijec je: ' ,max, ' a ona ima ', length(max) , ' znakova' );
writeln('U datoteci ima ukupno ' , duz , ' rijeci');
writeln('Sortirani podaci spremljeni su u izlaz.txt');
readln;
end.
program rad_sa_datotekom;
uses crt;
var a:text;
x,y,j,duz,vece,manje:integer;
b,t:array [1..100] of string;
max,min:string;
begin
clrscr;
assign(a,'c:\ulaz.txt');
reset(a);
duz:=0;
writeln('NESORTIRANI NIZ:');
while not eof(a) do
begin
inc(duz);
readln(a,b[duz]);
writeln(b[duz]);
end;
close(a);
for x:=duz-1 downto 1 do
for j:=1 to x do
begin
if b[j]>b[j+1] then
begin
t[j]:=b[j];
b[j]:=b[j+1];
b[j+1]:=t[j];
end;
end;
writeln;
writeln;
writeln;
writeln;
writeln('SORTIRANI NIZ:');
for j:=1 to duz do
begin
writeln(j,'.ime:',b[j]);
end;
vece:=0;
for y:=1 to duz do
begin
if length(b[y])>vece then max:=b[y];
end;
assign(a,'c:\izlaz.txt');
rewrite(a);
for j:=1 to duz do
begin
writeln(a,b[j]);
end;
close(a);
writeln;
writeln('U datoteci ulaz.txt najdulja rijec je: ' ,max, ' a ona ima ', length(max) , ' znakova' );
writeln('U datoteci ima ukupno ' , duz , ' rijeci');
writeln('Sortirani podaci spremljeni su u izlaz.txt');
readln;
end.
Pa kom se da neka pise

