Usage of cout<
Release: 2024-04-29 09:56:22
Original
420 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-11-21 18:07:47
-
2024-11-21 18:07:16
-
2024-11-21 18:06:52
-
2024-11-21 15:07:20
-
2024-11-21 15:07:08
-
2024-11-21 15:06:54
-
2024-11-21 15:06:40
-
2024-11-21 15:03:54
-
2024-11-21 15:03:44
-
2024-11-21 15:03:32