#include <iostream>
int main() {
std::cout << "Hello, World!";
return 0;
}
- Include the iostream header: This line includes the iostream header file, which contains the declarations for the input/output stream objects, such as cin and cout.
- Define the main function: This line defines the main function, which is the entry point for all C++ programs. Execution of the program starts from the main function.
- Output "Hello, World!": This line uses the cout object from the std namespace to output the "Hello, World!" message to the standard output (usually the console).
- Return 0: This line returns an integer value of 0 from the main function, indicating successful execution of the program.