answersLogoWhite

0

In simple terms, unformatted input and output is the most primitive form of input and output. It typically offers the most compact storage but is generally less portable than formatted input and output.

If we consider the decimal value 1.23, there are various ways we can output this value. We might choose to use unformatted output using IEEE 754 encoding, creating the 4-byte binary value 0x3f9d70a4. However, in order to input this value upon another system, we must first tell that other system to expect an IEEE 754 value otherwise the binary value could be interpreted as being the integer value 1,067,282,596 or the character sequence "? p ¤ " or something else entirely.

With formatted input and output, instead of the value 1.23 we output the null-terminated string "1.23", thus creating the 5-byte binary value 0x312e323300. When we come to input that value, the system does not need to know the specifics of the encoding, it simply needs to know that the input is formatted. Thus we read back the string "1.23", which can then be converted to the floating point value 1.23 using whatever encoding the system actually supports.

Humans typically input data in formatted form using character sequences. So when entering the value 1.23 from the keyboard, we generate the string "1.23". If the system knows that it is expecting a floating point value, then it will attempt to convert the string accordingly, creating unformatted data from the formatted input. Similarly, when the computer presents the unformatted value 1.23 as output to the user, it is converted back to a string creating formatted output from the unformatted data.

When we create formatted output from unformatted output, we can also choose to decorate the output, such that the unformatted value 1.23 might be represented as the formatted value "£1.23" if the value happens to represent a UK currency value. Similarly, we can do a reverse conversion when the user inputs the formatted value "£1.23".

User Avatar

Wiki User

9y ago

What else can I help you with?

Related Questions

Difference between formatted and unformatted function in c with example?

Disks and partitions should be formatted before usage.


How do the IO facilities in C plus plus differ from those in C?

The C standard library IO facilities are not extensible. For instance, the printf() and scanf() functions cannot handle user-defined types. However, the C++ standard library provides IO streams with insertion and extraction operators (<< and >>) that can be overloaded to support any user-defined type.


What are logical classes in c plus plus?

There is no such thing. Logic is bitwise operation, not a data type.


How can a constructor be invoked at the time of inheritance in C Plus Plus?

It cannot. Inheritance is a compile-time operation. Constructors are invoked at runtime at the point of instantiation.


What is b plus b plus b plus c plus c plus c plus c?

b+b+b+c+c+c+c =3b+4c


What is c plus c plus 2c plus c plus c equal?

c + c + 2c + c + c = 6c


B plus b plus b plus c plus c plus c plus c equals?

b + b + b + c + c + c + c = 3b + 4c


When was Operation C created?

Operation C was created on 1991-01-08.


When did Operation C happen?

Operation Cobra happened on 1944-07-31.


Are new and delete operators in c plus plus related to flush?

The new and delete operators in C++ are not related to flush. New is used to allocate memory, while delete is used to deallocate memory. Flush is a library concept that allows you to ensure that IO is completed, and not buffered, before proceeding to the next step.


Symplify c plus c plus c plus c?

4c


What is conio?

It is the Console IO header which is part of the C standard library.