Friday, September 12, 2014

More Examples on Console Application

Example 2



In the above example a string is being stored in a variable ‘tommy’ so that we can reuse it wherever we want it in the program.





Example 3

In the following example we will print something to the user and we want the user to respond back.
ReadKey() – Reads a single key from the user. Basically blocks the program until the key is pressed. 




  •  The message ‘type a number , any number?’ printed on screen
  • The key entered by user is stored in keyInfo
  • The value in keyInfo is converted to string and taken in {0}










No comments:

Post a Comment