<aside> 💡 Key concepts

Learning outcomes

1.1. C++ edit, compile and run cycle:

C++ is a powerful, general-purpose programming language that supports object-oriented, procedural, and generic programming. The edit-compile-run cycle refers to the process of creating, compiling, and executing a C++ program.

Development environment setup

In order to write, compile and run a C++ program, you need to have an Integrated Development Environment (IDE) installed on your computer. An IDE is a software application that provides a set of tools to help you write, test and debug code. There are many different IDEs available, but for this course, we will be using Visual Studio Code (VS Code) as our primary IDE.

To get started with VS Code, you can follow these steps:

  1. Download and install VS Code from the official website: **https://code.visualstudio.com/**

  2. Open VS Code and click on "File" -> "New File" to create a new file.

  3. Save the file with a .cpp extension (e.g. main.cpp) in a location where you can easily find it later.

  4. Write your C++ code in the file.

  5. To compile and run the program, you will need to install a C++ compiler. For Windows, we recommend using this tutorial to setup your development environment (for Mac users, MacOS should come with Clang compiler so you are good to go).

  6. After installing the compiler, open a command prompt or terminal window, navigate to the directory where you saved your .cpp file and type the following command to compile the code:

g++ -o main main.cpp

This will create an executable file called "main" in the same directory.

  1. To run the program, type the following command:
./main

This will execute the program and display the output on the console.