The worlds greatest computer program written in C++, there is also an explanation.
“Hello World!”, this program is written in every language as one of the most basic programs so almost all beginners can do it, I will show it in C++.
Here is it dissected, “//” means the rest of that line is commented out so the compiler doesn’t see it /* */ comments out all the code in between them
#include // #includes, does as it says it includes the file in the “< >”. The file ‘iostream.h’ aka Input Output stream is need for the further lines of code
using namespace std;// basically a way to type less, it includes the namespace, basically a library of functions. With out this you would need to write std::cout instead of cout
int main()// starts the main function, this is where all C++ programs start
{// shows the start of a function
cout << Hello World! << endl;// Cout aka Computer Output, is a simply writes to the console, it write what is after the <<, if its next it needs to be in a “”. (endl simply ends the line)
return 0;//simply exits out of the function with the return value of 0
} // shows the end of a function
/*
depending on your compiler the program may open and close so fast that you don’t see it, to fix this add
“#include ” to the top of the file and “system(”PAUSE”);” one the line before “return 0;”
this will stop the program from cloding till you hit a key */












Leave Your Response