CPP Hello World - JadenGil/Jaden-Tech-Journal GitHub Wiki
#include
int main() {
std::cout << "Hello World!";
return 0; }
How does it work?
#include is a preprocessor directive that is used in order to allow the coder to include files like "iostream" in the code. So, using #include in my code allows me to use "cout" in my code.
cout allows me to print output on my screen.
For any C++ code to work it needs to include int main() followed by { to indicate the beginning of the code. To end the code simply put a } on the final line of code.
Since this is an extremely basic code all that is needed is std::cout << "Hello World!";. std::cout allows for the text in the quotations to be printed on screen but in order for it to actually print it must be followed by << in order to indicate the end of a statement ; must be put on the end.
return 0; is the exit status of the program which just means that it is the end of the code
Don't forget!
for the code to be valid it must have } at the end