- 3
- 0
- 约1.03万字
- 约 30页
- 2021-11-30 发布于安徽
- 举报
Review Questions Null. * Chapter 10Console I/O Operations §10.1 C++ Stream C++ Stream Classes §10.2 Unformatted I/O Operations §10.3 Formatted Console I/O Operations §10.4 Managing Output with Manipulators * Input and Output? How to provide the input data present results? cin and cout How to control the format of input and output? C++ supports a rich set of I/O functions and operations C++ supports all of C’s rich set of I/O functions These functions and operations use the advanced features of C++: classes, inheritance, polymorphism Using stream and stream classes to implement its I/O operations with the console (this chapter), and with disk files(next chapter). * §10.1 C++ Stream Stream: an interface to operate on different I/O systems Display/terminals, hard disks, flash disks, etc… Independent of the actual device A stream is a sequence of bytes A program extracts the bytes from an input stream and inserts bytes into an output stream Input device Output device Program Output stream Input stream Extract Insert About C++ Stream A C++ program handles data (input/output) independent of the devices used. The data in the input stream can come from the keyboard or any other storage device. The data in the output can go to the screen or any other storage device : * The cin/cout stream Pre-defined streams Automatically opened when a program begins its execution. Standard input/output stream Connected to the standard input/output devices Usually the keyboard/screen. Can redirect streams to other devices or files freopen(test.txt, r, stdin); freopen(test.txt, w, stdout); cout“Test it.”endl; C++ Stream Classes Stream classes for console I/O operations: These classes are declared in the header file iostream: Eg: include iostream ios is declared as the virtual base class ios ostream istream streambuf iostream istream_withassign ostream_withassign iostream_withassign cin cout get(), read(), getline() overloading put(), write() overloading §10.2 Unformatted I/O
您可能关注的文档
- 高等数学课件:9-7常系数线性微分方程组.ppt
- 高等数学课件:10.1向量及其运算(1-30).ppt
- 高等数学课件:10.2 空间直角坐标系与向量代数(1-24).ppt
- 高等数学课件:10.3 平面与直线.ppt
- 高等数学课件:10.4.1曲面及其方程.ppt
- 高等数学课件:10.4.2二次曲面.ppt
- 高等数学课件:10.5向量函数 空间曲线.ppt
- 高等数学课件:10-1 收敛原理与数项级数.ppt
- 高等数学课件:10-2 正项级数.ppt
- 高等数学课件:10-3任意项级数.ppt
- 江西省九江市修水县统编版六年级下册期末考试道德与法治试卷【含答案】.pdf
- 江西省南昌市统编版六年级下册期末学业质量检测道德与法治试卷【含答案】.pdf
- 江西省宜春市高安市统编版六年级下册期末考试道德与法治试卷【含答案】.pdf
- 江西省宜春市袁州区统编版六年级下册期末考试道德与法治试卷【含答案】.pdf
- 辽宁省大连市甘井子区统编版六年级下册期末考试道德与法治试卷【含答案】.pdf
- 辽宁省锦州市统编版六年级下册期末考试道德与法治试卷【含答案】.pdf
- 湖南省永州市冷水滩区统编版六年级下册期末考试道德与法治试卷【含答案】.pdf
- 湖南省永州市双牌县统编版六年级下册期末考试道德与法治试卷【含答案】.pdf
- 湖南省岳阳市岳阳楼区等5地统编版六年级下册期末考试道德与法治试卷【含答案】.pdf
- 湖南省张家界市永定区统编版六年级下册期末考试道德与法治试卷【含答案】.pdf
原创力文档

文档评论(0)