0

Caly kod:

``````USES CRT;

VAR
user_s: string;
i, i2, i3, l1, l2, r, r1, r2, r3, user_l : integer;
la:  array[1..10000] OF integer;
ma: array[1..15] OF integer;
aa: array[1..15] OF integer;

BEGIN

la[1]:=1;
la[2]:=1;
ma[1]:=1;
ma[2]:=2;

for i:=1 to 15 do
begin

if i>2 then
begin

for i2:=1 to i do
begin
ma[i]:= ma[i-1]*2;
end;

end;

end;

for i:=1 to 10000 do
begin

if i>2 then
begin
la[i]:= la[i-1] + la[i-2];
end;

end;
writeln('Podaj Liczbe:');

clrscr;
delay(200);
for i:=1 to 3 do
begin
write('.');
delay(200);
end;
delay(500);
clrscr;
writeln('Twoja liczba: ', user_l);
writeln('');
writeln(user_l, ' w ciagu Finobiachego to: ', la[user_l]);

r:=la[user_l];
for i:=1 to 15 do
begin
i2:= 16-i;
r3:= ma[i2];
if i=1 then
Begin
r1:= r-r3;
if r1>=0 then
begin
aa[i]:= 1;
r2:= r1;
end
else
if r1<0 then
begin
aa[i]:=0; r2:= r;
end;
End
Else
Begin
r1:= r2 - r3;
if r1>=0 then
begin
aa[i]:= 1;
r2:= r1;
end
else
if r1<0 then
begin
aa[i]:=0;
end
End;
end;

write('W systemi Binarnym wyglada ona tak: ');
for i:=1 to 15 do
begin
if i=1 then write('0');
write(aa[i]);
if i=3 then write(' ');
if i=7 then write(' ');
if i=11 then write(' ');
end;

for i:=1 to 5 do writeln('');
writeln('Wpisz "s" aby sprawdzic.');

if user_s='s' then
begin

writeln('Twoja liczba w binarnym:');
for i:=1 to 15 do
begin
if i=1 then write('0');
write(aa[i]);
if i=3 then write(' ');
if i=7 then write(' ');
if i=11 then write(' ');
end;

for i:=5 to 10 do writeln('');
writeln('Sprawdz:');
for i:=1 to 15 do
begin
i2:= 16-i;
writeln(ma[i],' | ', aa[i2]);
if i=4 then writeln('') else begin if i=8 then writeln(''); if i=12 then writeln('') end;
if i=15 then writeln('32768 | 0');
end;

end;

delay(9999);
clrscr;
writeln('Author: interjaz');
writeln('From: Poland, Gorzow');
for i:=1 to 5 do writeln('');
delay(100);
writeln('Thank for using');

END.
``````

jak widac dopiero zaczynam.
Mam maly problem z:

a)

...
writeln('Wpisz "s" aby sprawdzic.');
read(user_s); nie chce raedowac mi.. po prostu progrma po skomplikowanie jakby omijak ta linijke kodu

...

b)

oraz jak widac dwarazy pojawia sie

for i:=1 to 15 do
begin
if i=1 then write('0');
write(aa[i]);
if i=3 then write(' ');
if i=7 then write(' ');
if i=11 then write(' ');
end;

chcailbym aby to bylo procedura aby dwa razy nie musial wpisywac tego samego ;)

wiec zrobielem

procedure binary(i: integer; aa: array[1..15] of integer);
BEgin
for i:=1 to 15 do
begin
if i=1 then write('0');
write(aa[i]);
if i=3 then write(' ');
if i=7 then write(' ');
if i=11 then write(' ');
end;
ENd;

ale to nie dziala

prosze o pomoc dzieki z gory

0