讨论 / 怎么回事??
Wych 2008-08-07 07:51:00
点我顶贴 收藏 删除
提交时出现:“!程序中含有不安全字符(或者为NOI不允许使用的语句):rewrite”
#1 Wych@2008-08-07 07:22:00
回复 删除
顶~~~
#2 Wych@2008-08-07 07:51:00
回复 删除
再麻烦高手们帮忙:

请看看我的程序为什么会出现上述问题

代码如下:

program translate(input,output);

var s,s1,s2:string;

l,ll:longint;

ch:char;

a:array [1..12] of 0..9;

procedure writel(c:char);

begin

case c of

’0’:write(’zero’);

’1’:write(’one’);

’2’:write(’two’);

’3’:write(’three’);

’4’:write(’four’);

’5’:write(’five’);

’6’:write(’six’);

’7’:write(’seven’);

’8’:write(’eight’);

’9’:write(’nine’);

end;

end;

procedure printe;

var i:longint;

begin

for i:=1 to l-ll-1 do

begin writel(s2[i]);

write(’ ’);

end;

writel(s2[l-ll]);

end;

procedure dos(ss:string);

var i:longint;

l1,l2:integer;

begin

l1:=1;

l2:=1;

for i:=2 to ll do

if ss[i]=’Y’ then l1:=i;

if l1>1 then for i:=1 to (l1 div 2) do

case ss[i*2] of

’Y’:a[4]:=ord(ss[i*2-1])-48;

’Q’:a[1]:=ord(ss[i*2-1])-48;

’B’:a[2]:=ord(ss[i*2-1])-48;

’S’:a[3]:=ord(ss[i*2-1])-48;

end;

for i:=l1+1 to 8 do

if ss[i]=’W’ then l2:=i;

if l2>1 then for i:=(l1 div 2)+1 to (l2 div 2) do

case ss[i*2] of

’W’:a[8]:=ord(ss[i*2-1])-48;

’Q’:a[5]:=ord(ss[i*2-1])-48;

’B’:a[6]:=ord(ss[i*2-1])-48;

’S’:a[7]:=ord(ss[i*2-1])-48;

end;

for i:=l2+1 to ll-2 do

case ss[i+1] of

’Q’:a[9]:=ord(ss[i])-48;

’B’:a[10]:=ord(ss[i])-48;

’S’:a[11]:=ord(ss[i])-48;

end;

if ord(ss[ll-1])<58 then a[12]:=ord(ss[ll-1])-48;

end;

procedure pp(r:integer);

var q:char;

begin

if a[r]=1 then write(’a hundred ’)

else begin q:=chr(a[r]+48);

writel(q);

write(’ hundred ’);

end;

if (a[r]=0) and (a[r+1]=0) and (a[r+2]=1) and (r<>10) then write(’a’,’ ’);

if a[r+1]=1 then case a[r+2] of

0:write(’and ten ’);

1:write(’and eleven ’);

2:write(’and twelve ’);

3:write(’and thirteen ’);

4:write(’and fourteen ’);

5:write(’and fifteen ’);

6:write(’and sixteen ’);

7:write(’and seventeen ’);

8:write(’and eighteen ’);

9:write(’and nineteen ’);

end

else begin case a[r+1] of

2:write(’and twenty’);

3:write(’and thirty’);

4:write(’and forty’);

5:write(’and fifty’);

6:write(’and sixty’);

7:write(’and seventy’);

8:write(’and eighty’);

9:write(’and ninety’);

end;

case a[r+2] of

0:write(’ ’);

1:write(’-one ’);

2:write(’-two ’);

3:write(’-three ’);

4:write(’-four ’);

5:write(’-five ’);

6:write(’-six ’);

7:write(’-seven ’);

8:write(’-eight ’);

9:write(’-nine ’);

end;

end;

end;

procedure printll;

begin

if a[1]+a[2]+a[3]>0 then begin pp(1);

write(’billion’,’ ’);

end;

if a[4]+a[5]+a[6]>0 then begin pp(4);

write(’million’,’ ’);

end;

if a[7]+a[8]+a[9]>0 then begin pp(7);

write(’thousand’,’ ’);

end;

if a[10]+a[11]+a[12]>0 then begin pp(10);

write(’ ’);

end;

end;

procedure print1;

begin

if ll=2 then begin writel(s[1]);

write(’ ’);

end

else begin dos(s1);

printll;

end;

end;

begin

read(s);

l:=length(s);

ll:=1;

ch:=s[ll];

fillchar(a,sizeof(a),0);

while not (ch=’D’) do begin inc(ll);

ch:=s[ll];

end;

if ll=l then begin s1:=s;

print1;

end

else begin s1:=copy(s,1,ll-1);

s2:=copy(s,ll+1,l-ll);

print1;

write(’point’,’ ’);

printe;

end;

end.

查看更多回复
提交回复