Vanilla 1.1.5a jest produktem Lussumo. Więcej informacji: Dokumentacja, Forum.
Program system_dwojkowy_na10_i_na_odwrot;
uses crt;
const
dz=2;
var
i:integer;
k:integer;
Procedure dwa;
var
wynik:array[1..400] of byte;
liczba:integer;
a:integer;
begin
clrscr;
write('Podaj liczbe w systemie dziesietnym : ');
readln(liczba);
i:=0;
while liczba>0 do begin
i:=i+1;
a:=liczba div dz;
wynik :=liczba-a*2;
liczba:=a;
end;
write('Oto ta liczba w systemie binatnym : ');
for k:=i downto 1 do write(wynik[k]);
readkey;
end;
Procedure bin;
var
liczba:string;
b:integer;
f:text;
stat:boolean;
z:integer;
liczba2:integer;
g:integer;
pot:integer;
begin
clrscr;
assign(f,'a');
rewrite(f);
write('Podaj lizcbe uzywajac tylko 0 i 1 : ');
readln(liczba);
stat:=true;
for i:=1 to length(liczba) do
if (liczba <>'0')and(liczba <>'1') then stat:=false;
z:=0;
if stat=false then write('zle podana liczba');
liczba2:=0;
if stat=true then begin
for b:=length(liczba) downto 1 do writeln(f,liczba );
close(f);
reset(f);
pot:=1;
while not eof(f) do begin
readln(f,b);
if z>=1 then begin
for i:=1 to z do pot:=pot*2;
liczba2:=liczba2+b*pot;
z:=z+1;
pot:=1;
end;
if z=0 then begin liczba2:=liczba2+b; z:=z+1;end;
end;
end;
close(f);
erase(f);
writeln;
writeln;
write('Oto liczba : ', liczba2);
readln;
end;
Procedure modul;
var ch:char;
begin
repeat
clrscr;
writeln('--- K ---');
writeln('--- O ---');
writeln('--- N ---');
writeln('--- W ---');
writeln('--- E ---');
writeln('--- N ---');
writeln('--- T ---');
writeln('--- E ---');
writeln('--- R ---');
readln;
clrscr;
writeln('1 - system dziesiętny');
writeln('2 - system binarny');
writeln('Wyjscie <ESC>');
ch:=readkey;
if ch='1' then dwa;
if ch='2' then bin;
until ch=#27;
end;
begin
modul;
end.
Proszę o pomoc,pozdrawiam! Od 1 do 1 z 1