• Post Reply Bookmark Topic Watch Topic
  • New Topic

RESULT IS TWICCE WHY?  RSS feed

 
gul khan
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Strange results if type 1 and then eter result is in 3 times why?

[This message has been edited by Peter Tran (edited February 21, 2001).]
 
Peter Tran
Bartender
Posts: 783
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
gul,
When you press "1" and return, you're actually passing in three characters. The first is the number "1" followed by the carriage return (CR) and line feed (LF) which are 13 and 10 respectively.
If you modified your code to print out the read int value, you'll see 49 10 13. The ASCII value for the number 1 is 49.

-Peter
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!