Mark As Completed Discussion

Creating a Hello World program

After setting up your C++ development environment, let's dive straight into the basic syntax of C++ by creating, compiling, and running a simple 'Hello World' program. This initial step will provide you with a practical understanding of the workflow you'll use for all your C++ developments.

Creating a Hello World program

In many software languages like JavaScript or Python, you're used to writing a script and directly running the program. In contrast, with C++, we'll be compiling our script into runnable code.

Creating your first C++ program involves these steps:

  1. Writing the program: You first write your script (the 'Hello World' program we'll create) using a text editor or Integrated Development Environment (IDE).
  2. Compiling the program: You then use your C++ compiler (g++ or clang) to turn the script into a machine language file (also known as a binary file).
  3. Running the program: Finally, you execute the binary file from your terminal or command prompt.

A simple 'Hello World' program in C++ looks like this:

CPP
OUTPUT
:001 > Cmd/Ctrl-Enter to run, Cmd/Ctrl-/ to comment