Coupon Accepted Successfully!


Formatted and Unformatted Data

Formatting means representation of data with different settings as per the requirement of the user. The various settings that can be done are number format, field width, decimal points, etc.

The data accepted or printed with default setting by the I/O function of the language is known as unformatted data. For example, when the cin statement is executed, it asks for a number. The user enters a number in decimal. For entering decimal number or displaying the number in decimal using cout statement, the user will not need to apply any external setting. By default, the I/O function represents the number in decimal format. Thus, the data handled in such a way is called as unformatted data.

If the user needs to accept or display data in hexadecimal format, manipulators with I/O functions should be used. The data obtained or represented with these manipulators are known as formatted data. For example, if the user needs to display the data in hexadecimal format, then the manipulator can be used as follows.



The above statement converts decimal 15 to hexadecimal F.

Test Your Skills Now!
Take a Quiz now
Reviewer Name