cout
The "cout" is an output stream object used to send data to the standard output device, usually the console. It is part of the C++ Standard Library.
Example:
#include <iostream>
using namespace std;
int main() {
cout << "Hello, world!";
return 0;
}
Explanation:
- #include <iostream>
: This line includes the iostream library, which contains the definition for the "cout" object.
- using namespace std;
: This line allows us to use elements of the "std" namespace without prefixing them with "std::".
- cout << "Hello, world!";
: This line sends the string "Hello, world!" to the standard output. The "<<" operator is used to insert data into the "cout" object.
- return 0;
: This line indicates that the program executed successfully and returns 0 to the operating system.