Get the App
SLTechnology News&Howtos  ›  Development  › 

Example Analysis of C++ input and output streams

Shulou Source: shulou.com Published: 2022-06-01 11:13:13 10月06日 Update

This article is to share with you the content of a sample analysis of C++ 's input and output streams. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

Input and output streams

Input data from the keyboard and output to the display screen. This kind of input and output is called standard input and output, which is referred to as standard Imax O.

Input data from the disk file, and output the data to the disk file, which is referred to as the file Icano.

Input and output to the specified space in memory, usually designating an array of characters as the storage space (storing any information), called string input and output, or string Icano for short

Buffer: both input and output exist in the cache.

Standard input stream

Commonly used member functions

Get () to get a character

Char c = cin.get ()

The newline character in the home buffer can be removed with cin.get (). Pay attention to the type of return value and the type of data it takes when it is output.

2cin.get (two parameters) get string

The parameter is the name and number of the string array

When using the string cin.get (two arguments), the newline character\ 0 is left in the buffer.

Char buf = {0}; cin.get (buf, 100); cout

Tags: Characters input output string result buffer buffer parameter that is file content number time two cardinality data array run standard flag Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Huawei MySQL Docker vpn macOS