- 问答
- 2016-01-03 14:28:55 @
我之前做了一个进制转换,但打开一个文件后输出,关闭,再输出(我要直接输出在窗口里),显示103错误。
代码:
program n;
uses crt;
var a:array[2..100] of string[100];
var b:array[1..63] of 0..99;
var c,i,j:qword;
var d,f,g:2..100;
var e:string[63];
var h:0..100;
var k,l:0..63;
var m:string;
begin
i:=1;
a[2]:='01';
a[3]:='012';
a[4]:='0123';
a[5]:='01234';
a[6]:='012345';
a[7]:='0123456';
a[8]:='01234567';
a[9]:='012345678';
a[10]:='0123456789';
a[11]:='0123456789A';
a[12]:='0123456789AB';
a[13]:='0123456789ABC';
a[14]:='0123456789ABCD';
a[15]:='0123456789ABCDE';
a[16]:='0123456789ABCDEF';
a[17]:='0123456789ABCDEFG';
a[18]:='0123456789ABCDEFGH';
a[19]:='0123456789ABCDEFGHI';
a[20]:='0123456789ABCDEFGHIJ';
a[21]:='0123456789ABCDEFGHIJK';
a[22]:='0123456789ABCDEFGHIJKL';
a[23]:='0123456789ABCDEFGHIJKLM';
a[24]:='0123456789ABCDEFGHIJKLMN';
a[25]:='0123456789ABCDEFGHIJKLMNO';
a[26]:='0123456789ABCDEFGHIJKLMNOP';
a[27]:='0123456789ABCDEFGHIJKLMNOPQ';
a[28]:='0123456789ABCDEFGHIJKLMNOPQR';
a[29]:='0123456789ABCDEFGHIJKLMNOPQRS';
a[30]:='0123456789ABCDEFGHIJKLMNOPQRST';
a[31]:='0123456789ABCDEFGHIJKLMNOPQRSTU';
a[32]:='0123456789ABCDEFGHIJKLMNOPQRSTUV';
A[33]:='0123456789ABCDEFGHIJKLMNOPQRSTUVW';
a[34]:='0123456789ABCDEFGHIJKLMNOPQRSTUVWX';
a[35]:='0123456789ABCDEFGHIJKLMNOPQRSTUVWXY';
a[36]:='0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ';
writeln('按Enter确认');
write('请输入待转换的数的进制(2-100):');
readln(d);
clrscr;
writeln('按Enter确认');
writeln('请输入待转换的数的进制(2-100):',d);
writeln('请输入待转换的数(十进制的值在0-18446744073709551615):');
readln(e);
clrscr;
writeln('按Enter确认');
writeln('请输入待转换的数的进制(2-100):',d);
writeln('请输入待转换的数(十进制的值在0-18446744073709551615):');
writeln(e);
write('请输入转换进制的下标(2-100):');
readln(f);
clrscr;
writeln('按Enter确认');
writeln('请输入待转换的数的进制(2-100):',d);
writeln('请输入待转换的数(十进制的值在0-18446744073709551615):');
writeln(e);
writeln('请输入转换进制的下标(2-100):',f);
write('请输入转换进制的上标(2-100):');
readln(g);
clrscr;
for h:=f to g do
if h<=36 then begin
writeln(h,'进制是否需要自定义表意符号? 1.是 2.否');
if readkey='1' then begin
writeln('请输入',h,'进制表意符号(',h,'个字符):');
readln(a[h]);
end;
end
else begin
writeln('请输入',h,'进制表意符号(',h,'个字符):');
readln(a[h]);
end;
for h:=length(e) downto 1 do
begin
c:=c+(pos(e[h],a[d])-1)*i;
i:=i*d;
end;
writeln('是否保存输入? 1.是 2.否');
if readkey='1' then begin
write('请输入文件名:');
readln(m);
assign(output,m);
rewrite(output);
writeln(d);
writeln(e);
writeln(f);
writeln(g);
close(output);
end;
for h:=f to g do
begin
fillchar(b,sizeof(b),0);
j:=c;
k:=0;
while j>0 do
begin
k:=k+1;
b[k]:=j mod h;
j:=j div h;
end;
writeln(h,'进制:');
for l:=k downto 1 do
write(a[h][b[l]+1]);
writeln;
end;
writeln('按Esc退出');
while readkey<>'' do
end.
还有3.0.0版本怎么输出**中文**?