Archived

This topic is now archived and is closed to further replies.

Fella

Pascal problem

Recommended Posts

program blabla; var c : char; begin while c <> ''&'' do begin read(c); if (c >= ''a'') and (c <= ''z'') then writeln(c) else writeln(ord(c)); end; end. For example input is letter ''b''. I get this output: b 13 10 Why are 10 and 13 in the output?????

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
it''s been awhile since i took Pascal. great language though

if (c >= ''a'') and (c <= ''z'') then writeln(c)<----
else writeln(ord(c));

shouldn''t writeln(c) have a semicolon? (referring to the arrow)

Share this post


Link to post
Share on other sites
#13+#10 is the return carrage (new line) sequence. It goes back to line printers (which could/can be used in place of the screen). One character tells it to move the cursor down one line, the other tells it to go to the beginning of the line (move left).

Share this post


Link to post
Share on other sites
quote:
Original post by Anonymous Poster

if (c >= ''a'') and (c <= ''z'') then writeln(c)<----
else writeln(ord(c));

shouldn''t writeln(c) have a semicolon? (referring to the arrow)


Just like to point out in case it helps anyone, as far as I know you dont use a semicolon before an else.

Share this post


Link to post
Share on other sites