hello world program in c++
#include <iostream>
int main() {
std::cout << "Hello, World!";
return 0;
}
Explanation:
#include <iostream>
: This line includes the input/output stream library, which allows input and output operations to be performed in the program.int main() { }
: This is the main function where the execution of the program begins. In C++, every program must have amain
function.int
specifies that the function returns an integer value.std::cout << "Hello, World!";
:std::cout
is used to output data to the console. The<<
operator is used to insert the string "Hello, World!" into the standard output stream.return 0;
: This statement signifies the end of themain
function and returns an integer value (0
) to the operating system, indicating that the program executed successfully.