Usage of cout<
Release: 2024-04-29 09:56:22
Original
392 people have browsed it
In C, cout<
##Usage of cout<
Concept:
cout<
Usage:
Use cout<cout << data << endl;
Copy after login
where:
- cout:Standard output object
- data:The data to be output can be a string, numerical value, variable or expression
- endl: Line break
Effect:
When using cout<- Output data: Output the value of data to the standard output device.
- Line break: Wrap the line after the output data.
Example:
#include <iostream>
using namespace std;
int main() {
cout << "Hello World!" << endl; // 输出 "Hello World!" 再换行
cout << 123 << endl; // 输出数字 123 再换行
return 0;
}</p>
<p>Output:<strong></strong></p>
<pre class="brush:php;toolbar:false">Hello World!
123
Copy after login
Notes:
endl is a newline character, and "\n" is also a newline character. They can both be used for line breaks, but endl is recommended because it is more portable. - cout<
The above is the detailed content of Usage of cout<
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
-
2024-10-17 11:08:01
-
2024-10-17 11:01:01
-
2024-10-17 08:37:31
-
2024-10-17 08:34:02
-
2024-10-17 08:30:32
-
2024-10-17 08:27:02
-
2024-10-17 08:23:31
-
2024-10-17 08:20:02
-
2024-10-17 08:16:32
-
2024-10-17 08:13:01