Ask Question

Name:
Title:
Your Question:

Answer Question

Name:
Your Answer:
User Submitted Source Code!


Description:
  fff
Language: PASCAL
Code:
program asdas;

function cnv(s:string):string;
var nr,pow,i,e :integer;
    q:string;
begin
nr:=0;
pow:=1;
for i:=1 to length(s) do begin
if s[i] = '1' then nr:= nr + pow;
pow:= pow*2;
end;
val(q,nr,e);
cnv:=q;
end;

var s,q:string;
    i:integer;

begin
write('s=');
read(s);
q := '';
for i:=1 to length(s) do begin
  write(q);
  if s[i] = ' ' then begin
    write(cnv(q));
    q:='';
    end
  else q:= q + s[i];
  end;

end.
Comments: