

It is by default the standard output stream. Note: Cout is a stream which outputs to the stream specified. It should return a zero from the main function meaning the program ran successfully and exited. Don’t worry about this other than the fact that it is required by the “int” in front of the main function definition. Its purpose is only to return a value to the function or process that is called the main function. endl inserts a newline character on the same line)Ĭode line 7: return 0 This is the last command in the main function, the return statement. ( Note: A string literal is a sequence of characters surrounded by double quotes.

In this case, the string literal “Hello, World!” is written onto the standard output stream std:: cout.

The source code is compiled into object files. Your First Program: C++ “Hello World!” ExplanationĬ++ is a compiled language. This will open an area where you be able to type out your code.Īfter that you can write the C++ code as shown in the image below:Īfter saving you should see a black screen outputting “Hello World.” To do this select File > New > Source File. Once the program opens, you need to create a new source file, so you can start writing your first C++ program.
