|
|
back to boardHelp! What's wrong with this program? (Any help aprecciated) Var ch: char; i,n: integer; a: array [1..255] of char; Begin n:= 0; Repeat read(ch); if (ch in ['a'..'z']) or (ch in ['A'..'Z']) then begin Inc(n); a[n]:= ch; end else begin for n:= n downto 1 do write(a[n]); n:= 0; write(ch); end; until (eof); End. Re: Help! It's difficult to say. There were some problems about this problem, because many people solved during the online contest? and then recieved an e-mail where i8t was written that it was a mistake, and it's WA. Re: Help! Posted by JL Wang 18 Nov 2002 19:13 > What's wrong with this program? (Any help aprecciated) > > Var > ch: char; > i,n: integer; > a: array [1..255] of char; > > Begin > n:= 0; > Repeat > read(ch); > if (ch in ['a'..'z']) or > (ch in ['A'..'Z']) then begin > Inc(n); > a[n]:= ch; > end > else begin
> for n:= n downto 1 do > write(a[n]); > n:= 0; > write(ch); > end; > until (eof); > End. When you press key "Enter" it contains two symbol, but you cna only read one. Thanks!, but... Thanks for the help! How can I fix that problem? |
|
|