Why Include Iostream.h?

Posted On
Socialize It →
0
Why Include iostream.h?

The header file iostream.h is included in every C++ Program to implement input/output facilities. Input/Output facilities are not defined within C++ Language, but rather are implemented through a component of C++ standard library, Iostream.h which is I/O Libaray.

In C++, all devices are treated as files. Thus, the standard input device, the standard error device are all treated as files. At its lowest level, a file is interpreted simply as a sequences, or stream of bytes without considering its data type. However, at the user level, a file consists of a sequences of possible intermixed data types- Characters, arithmetic, values, class objects etc.

The Function of I/O Library – Iostream.h

1. At the lowest implementation level, where the notion of data types is missing and files are treated as streams of bytes, the I/O library manages the transfer of these bytes.

2. At the user level, where the notion of data types is present , I/O library manages the interface between these two levels i.e, between user level and the lowest implement level.

3. The I/O library predefines a set of operations for handling reading and writing of built-in data types.

Predefined Streams in I/O Library

A stream’s is simply a sequence of byes.

The Predefined stream objects for input, output and error are as follows:
1. Cin ( See-in) as istream class object tied to standard input. Cin stands for Console input.

2. Cout ( See-out) as ostream class object tied to standard output. Cout stands for console output.

3.Cerr (See-err) as ostream class objects tied to standard error. Cerr stands for console error.

Declaration and functions of cin, cout and cerr are contained within iostream.h
If the #include<iostream.h> line is omitted in a program, each reference to cin, cout or cerr will be flagged as a type error by the computer.



0 comments:

Post a Comment

'