rostr8.pas

来自「This ar the basic programs that i did in」· PAS 代码 · 共 50 行

PAS
50
字号
var s:string;
    n,i,p,c:integer;
    cod:boolean;
begin
write('s=');
readln(s);
n:=0;
p:=1;
cod:=false;
   for i:= length(s) downto 1 do
begin
     if (s[i]>='0') and (s[i]<='9') then
                                    begin
                                    c :=ord(s[i])-ord('0');
                                    n:=n +c*p;
                                    end
                                    else if (upcase(s[i]) >='A') and (upcase(s[i])<='Z') then
                                                                                         begin
                                                                                         c:=ord(upcase(s[i]))-ord('A')+10;
                                                                                         n:=n+c*p;
                                                                                         end
                                                                                         else cod:=true;
p:=p*16;
end;
if cod=false then write(n)
            else write ('eroare la pozitia',length(s)-i +1);
readln;
end.





















⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?