go to home page   go to next page

created 07/10/2006, revised 04/17/2010


CHAPTER 24B — Formatted Output

This chapter discusses how to control the appearance of a number when it is converted into characters. This is usually done when a number is output to the monitor or to a file. For example, instead of

value = 13.333333333333334

you can ask for only two places right of the decimal point:

value = 13.34

This chapter is optional. Future chapters do not depend on it, so you can safely skip it. However, your programs will produce better looking output if you use number formatting.

Chapter Topics:

There is much more to formatting numbers than this chapter discusses. Sometime in the future you may wish to study the detailed documentation available on line.

Depending on their location and language, people use different formats for numbers, dates, times, and currency. How to customize a program for the location and language where it will be used is called internationalization. This chapter only briefly discusses this.


QUESTION 1:

How would you prefer to see this number displayed:

123456789