A Complete Guide to Programming in C++ part 9

A Complete Guide to Programming in C++ part 9. This book provides both novice and experienced programmers with a comprehensive resource manual for the C++ programming language. Readers gain experience in all aspects of programming, from elementary language concepts to professional software development, with in depth coverage of all the language elements en route. These elements are carefully ordered to help the reader create useful programs every step of the way. | STREAMS 59 I O Stream Classes During the development of C a new class-based input output system was implemented. This gave rise to the I O stream classes which are now available in a library of their own the so-called iostream library. The diagram on the opposite page shows how a so-called class hierarchy develops due to inheritance. The class ios is the base class of all other stream classes. It contains the attributes and abilities common to all streams. Effectively the ios class manages the connection to the physical data stream that writes your program s data to a file or outputs the data on screen contains the basic functions needed for formatting data. A number of flags that determine how character input is interpreted have been defined for this purpose. The istream and ostream classes derived from ios form a user-friendly interface for stream manipulation. The istream class is used for reading streams and the ostream class is used for writing to streams. The operator is defined in istream and is defined in ostream for example. The iostream class is derived by multiple inheritance from istream and ostream and thus offers the functionality of both classes. Further stream classes a file management class for example are derived from the classes mentioned above. This allows the developer to use the techniques described for file manipulation. These classes which also contain methods for opening and closing files will be discussed in a later chapter. Standard Streams The streams cin and cout which were mentioned earlier are instances of the istream or ostream classes. When a program is launched these objects are automatically created to read standard input or write to standard output. Standard input is normally the keyboard and standard output the screen. However standard input and output can be redirected to files. In this case data is not read from the keyboard but from a file or data is not displayed on screen but written to a file. The other two standard .

Không thể tạo bản xem trước, hãy bấm tải xuống
TÀI LIỆU MỚI ĐĂNG
21    139    1    23-05-2024
134    1    1    23-05-2024
7    65    2    23-05-2024
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.