how to print in c++
Printing in C++
#include <iostream>
int main() {
std::cout << "Hello, World!" << std::endl;
return 0;
}
Include the iostream header: This line includes the iostream library, which provides input and output streams such as cin and cout.
Define the main function: The main function is the entry point of the program.
Use the cout statement: The
std::cout
statement is used to print the "Hello, World!" message to the standard output.End the line: The
<< std::endl
part ends the line and flushes the output buffer.Return 0: The
return 0;
statement indicates successful program execution.