Jump to content
СофтФорум - всё о компьютерах и не только

помогите пожалуста


Recommended Posts

помогите пожалуста доделать программу что бы она с дробами работала

var

I:Integer; C:Char; Si,So:String; St:String[3];

const

S:array['0'..'7'] of String[3]=('000','001','010','011','100','101','110','111');

begin

ReadLn(Si);

while Length(Si) mod 3 <> 0 do Si:='0'+Si; { доп. строку влево до длины, кратной 3 }

So:='';

for I:=1 to Length(Si) div 3 do

begin

St:=Copy(Si,3*I-2,3); { 3*I-2 дает числа 1,4,7... - нач. позиции троек дв. цифр }

for C:='0' to '7' do if St=S[C] then So:=So+C

end;

Writeln(So);

end.

ето прога для перевода из 2СС в 8СС

пы. сы. СС - система счисления))))))

Link to comment
Share on other sites

Enemy_vn:

var i:integer; C:char; Fi,Fo,Si,So,Mi,Mo:string; St:string[3]; P:boolean;const S:array['0'..'7']of string[3]=('000','001','010','011','100','101','110','111');beginreadln(Fi); P:=Fi[1]='-'; if P or(Fi[1]='+') then delete(Fi,1,1);  i:=pos('.',Fi); if i=0 then begin Fi:=Fi+'.'; i:=length(Fi) end;Si:=copy(Fi,1,i-1); Mi:=copy(Fi,i+1,length(Fi)-i); So:=''; Mo:='';while length(Si) mod 3 <> 0 do Si:='0'+Si; while length(Mi) mod 3 <> 0 do Mi:=Mi+'0';for i:=1 to length(Si) div 3 do  begin St:=copy(Si,3*I-2,3); for C:='0' to '7' do if St=S[C] then So:=So+C end;for i:=1 to length(Mi) div 3 do  begin St:=copy(Mi,3*I-2,3); for C:='0' to '7' do if St=S[C] then Mo:=Mo+C end;if length(Mo)=0 then Fo:=So else Fo:=So+'.'+Mo; if P then Fo:='-'+Fo; writeln(Fo); readlnend.

Разделительный знак - точка.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...