官术网_书友最值得收藏!

Practicing and exploring

Test your knowledge and understanding by answering some questions, get some hands-on practice, and explore the topics covered in this chapter with deeper research.

Exercise 2.1 – test your knowledge

What type would you choose for the following "numbers"?

  1. A person's telephone number
  2. A person's height
  3. A person's age
  4. A person's salary
  5. A book's ISBN
  6. A book's price
  7. A book's shipping weight
  8. A country's population
  9. The number of stars in the Universe
  10. The number of employees in each of the small or medium businesses in the UK (up to about 50,000 employees per business)

Exercise 2.2 – practice number sizes and ranges

Create a Console Application project named Ch02_Exercise02 that outputs the number of bytes in memory that each of the following number types use and the minimum and maximum possible values they can have: sbyte, byte, short, ushort, int, uint, long, ulong, float, double, and decimal.

Tip

Read the online MSDN documentation for Composite Formatting, available at https://msdn.microsoft.com/en-us/library/txafckwd(v=vs.110).aspx, to learn how to align text in a console application.

The output of your application should look something like the following screenshot:

Exercise 2.3 – explore topics

Use the following links to read more about the topics covered in this chapter:

主站蜘蛛池模板: 眉山市| 白山市| 夹江县| 汾西县| 宁都县| 滕州市| 乐业县| 雷州市| 诏安县| 麦盖提县| 鄂托克旗| 墨玉县| 八宿县| 澄迈县| 北海市| 农安县| 布尔津县| 甘德县| 广宁县| 六枝特区| 涿鹿县| 丹巴县| 田林县| 扎兰屯市| 邵武市| 左云县| 加查县| 灌南县| 清远市| 平谷区| 福清市| 聊城市| 韩城市| 开鲁县| 大埔区| 长海县| 剑阁县| 广昌县| 浠水县| 新巴尔虎右旗| 皮山县|