输入、输出流部分内容

来源:互联网 发布:br软件图标 编辑:程序博客网 时间:2024/04/25 02:39

流插入运算符<<属于输出流。流读取运算符>>属于输入流

一、输出流:

1、流插入运算符<<输出标准类型;

2、用put成员函数输出字符;

cout.put(‘A’).put(‘/n’);

3、用write成员函数实现无格式输出;

4、以十进制、八进制、十六进制方式输出整数;

5、以各种精度方式输出浮点数;

6、强制输出带有小数点的浮点数;

7、以科学计数法和定点计数法表示浮点数;

8、在指定宽度的区域内对齐输出浮点数;

9、在区域内用特定字符填充;

10、以科学计数法和十六进制计数法输出大写字母;

二、输入流:

1、get、getline成员函数;

下面是关于get的一些介绍:

int_type get();basic_istream& get(    Elem& _Ch);basic_istream& get(    Elem *_Str,    streamsize _Count);basic_istream& get(    Elem *_Str,    streamsize _Count,    Elem _Delim);basic_istream& get(    basic_streambuf& _Strbuf);basic_istream& get(    basic_streambuf& _Strbuf,    Elem _Delim);
getline的介绍:
basic_istream& getline(    char_type *_Str,     streamsize _Count);basic_istream& getline(    char_type *_Str,     streamsize _Count,     char_type _Delim);

Parameters
_Count

The number of characters to read from strbuf.

_Delim

The character that should terminate the read if it is encountered before _Count.

_Str

A string in which to write.

_Ch

A character to get.

_Strbuf

A buffer in which to write.