Home > Article > Backend Development > What is the output string function in c++
The string output function is cout, which is used to output data on the standard output stream. The syntax for using cout to output a string: cout << "string".
String output function in C
In C programming, the function that outputs a string iscout
. cout
is part of the iostream
header file in the C standard library. It is an object of the ostream
class and is used on the standard output stream (usually the console) Output Data.
Use cout
to output a string
To use cout
to output a string, you can use the following syntax:
<code class="cpp">cout << "字符串";</code>
Among them, "string"
is the string literal to be output.
Example
The following code demonstrates how to use cout
to output a string:
<code class="cpp">#include <iostream> using namespace std; int main() { cout << "Hello, world!"; return 0; }</p> <p>output: </p> <pre class="brush:php;toolbar:false"><code>Hello, world!</code>
The above is the detailed content of What is the output string function in c++. For more information, please follow other related articles on the PHP Chinese website!