|
|
back to boardWhy I am wrong in test4#~~~~~~~~~ Posted by Ryan 20 Apr 2007 11:20 This is my code. {program Ryan; var n,i,k:integer; a:array[0..1000] of char; b:array[0..25] of 'a'..'z'; c,d:array[0..1000] of integer; begin for i:=0 to 25 do b[i]:=chr(i+97); i:=-1; repeat i:=i+1; read(a[i]); c[i]:=ord(a[i])-97; if (c[i]<26)and(i<>0) then while (c[i]<c[i-1])or (c[i]<26) do c[i]:=c[i]+26; until eoln; d[0]:=c[0]-5; for n:=0 to i do if n<>0 then d[n]:=c[n]-c[n-1]; for n:=0 to i do if d[n]>26 then begin d:=c; break; end; while k<i+1 do begin write(b[d[k]]); k:=k+1; end; end.} And I have sth. didn't understand. That is if I input 'asdffg',what is the output? Or if I input 'ghhllz',what is the output? Plz help me~ |
|
|