木野真琴邪恶漫画:我的PASCAL的程序问题

来源:百度文库 编辑:神马品牌网 时间:2024/04/28 07:48:03
程序
program afile (input,output,A,B);
var
A,B:text;
num:array['A'..'Z'] of integer;
y,i:integer;
x,ch:char;
begin
assign(A,'d:\A.txt');
assign(B,'d:\B.txt');
reset(A);
rewrite(B);
i:=i+1;
for ch:='A' to'Z' do
begin
num[ch]:=i;
i:=i+1;
end;
while not eof (A) do
begin
read(A,x);
if(x>='A') and (x<='Z')
then begin
y:=(num[x]+2) mod 26;
for ch:='A' to'Z' do
if num[ch]=y
then write(B,ch)
end;
end;
end.

运行以后怎么出来的是一个空的B文本
,A文本里的字母怎么没有被加密后打印在B文本里呢
很苦恼,哪位大哥大姐帮帮我啊,真是感激不尽
一楼的朋友,i没有初始化是什么意思?
朋友们能不能运行一下,然后把成功的程序贴上来啊,3Q

i没有初始化。

就是在begin后将i:=0

程序中的变量“i”好象不只是没有初始化的问题,我怀疑是否用混了?