Introduction
A “Hello, World!” program prints the “Hello, World!” in the output screen. Mostly every new programmer does this program for an introduction to Coding.
Following is the C++ “Hello, World!” program:
// Your First C++ Program
#include <iostream>
int main() {
std::cout << "Hello, World!";
return 0;
}
Output:
Hello, World!
You practice by yourself with the help of online c++ compiler.
Let us see each statement individually:
-
// Your First C++ Program: The lines which start with “//” are comments. These are the lines which are ignored by the C++ compiler.
-
#include <iostream>: It is a preprocessor directive used to include files in our program. In our current program, we are including the contents of <iostream> file.
-
std::cout << "Hello, World!";: This statement is used to print the String inside the quotation marks(“ “). In our current program, we are printing Hello, World!.
- return 0;: It is the Exit status of the program. The program terminates after this statement.
FAQs:
-
What is a “Hello, World!” program?
A “Hello, World!” program prints the “Hello, World!” in the output screen. Mostly every new programmer does this program for an introduction to Coding.
-
What is std::cout?
This statement is used to print the String inside the quotation marks(“ “). In our current program, we are printing Hello, World!.