C++毕业论文外文翻译
《C++毕业论文外文翻译》由会员分享,可在线阅读,更多相关《C++毕业论文外文翻译(9页珍藏版)》请在毕设资料网上搜索。
1、 2012 年毕业设计论文英汉互译部分 Chapter 8. The IO Library In C+, input/output is provided through the library. The library defines a family of types that support IO to and from devices such as files and console windows. Additional types allow strings to act like files, which gives us a way to convert data to an
2、d from character forms without also doing IO. Each of these IO types defines how to read and write values of the built-in data types. In addition, class designers generally use the library IO facilities to read and write objects of the classes that they define. Class types are usually read and writt
3、en using the same operators and conventions that the IO library defines for the built-in types. This chapter introduces the fundamentals of the IO library. Later chapters will cover additional capabilities: Chapter 14 will look at how we can write our own input and output operators; Appendix A will
4、cover ways to control formatting and random access to files. Our programs have already used many IO library facilities: istream (input stream) type, which supports input operations ostream (output stream) type, which provides output operations cin (pronounced see-in) an istream object that reads the
5、 standard input. cout (pronounced see-out) an ostream object that writes to the standard output cerr (pronounced see-err) an ostream object that writes to the standard error. cerr is usually used for program error messages. operator , which is used to read input from an istream object operator to re
6、ad data regardless of whether we re reading a console window, a disk file, or an in-memory string. Similarly, we d like to use that operator regardless of whether the characters we read fit in a char or require the wchar_t(Section2.1.1,p.34) type. At first glance, the complexities involved in suppor
7、ting or using these different kinds of devices and different sized character streams might seem a daunting problem. To manage the complexity, the library uses inheritance to define a set of object-oriented classes. Well have more to say about inheritance and object-oriented programming in Part IV, b
8、ut generally speaking, types related by inheritance share a common interface. When one class inherits from another, we (usually) can use the same operations on both classes. More specifically, when two types are related by inheritance, we say that one class inherits the behavior the interface of its
9、 parent. In C+ we speak of the parent as the base class and the inheriting class as a derived class. The IO types are defined in three separate headers: iostream defines the types used to read and write to a console window, fstream defines the types used to read and write named files, and sstream de
10、fines the types used to read and write in-memory strings. Each of the types in fstream and sstream is derived from a corresponding type defined in the iostream header. Table 8.1 lists the IO classes and Figure 8.1 on the next page illustrates the inheritance relationships among these types. Inherita
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中设计图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- C+ 毕业论文 外文 翻译
