Code:
#include <iostream>
using namespace std;
int main() {
cout<<"Hello World!"<<endl;
return 0;
}
Line-by-Line Function:
#include <iostream> //This and the following line allow the program to access external information such as commands for use within the file.
using namespace std; //See above
int main() { //Begins and initializes the function that will run the primary program.
cout<<"Hello World!"<<endl; //Prints the exact characters "Hello World!" and then ends the line, moving to a new one.
return 0; //This and the following line end the "main()" function by returning a null value.
} //See above
Compiling and running the program in the Linux Terminal:
[cms-opendata@localhost src]$ g++ -Wall main.cpp -o main //Compiling
[cms-opendata@localhost src]$ ./main //Running
Hello World! //Code output