Home.

First Lesson

Cover Image for First Lesson
Salomon Lee
Salomon Lee

Week 1: Introduction to C++ 1.

Introduction to Programming and C++

  • What is programming?
  • History of C++
  • Installing a C++ compiler (GCC, Clang, Visual Studio)

What is Programming?

Welcome to our first lesson on Introduction to C++. Today, we will start by understanding what programming is. Programming is the process of creating a set of instructions that tell a computer how to perform specific tasks. These instructions, commonly referred to as code, are written in various programming languages. Programming enables us to develop software applications, games, websites, and numerous other digital tools that we use daily.

  • Programming is the process of creating a set of instructions that tell a computer how to perform a task.
  • These instructions, known as code, are written in a programming language.
  • Programming allows us to create software applications, games, websites, and much more.

History of C++

Now, let's take a brief look at the history of C++. C++ was developed by Bjarne Stroustrup at Bell Labs in 1979. Initially, it was called 'C with Classes' because it introduced object-oriented programming features to the C language. The name 'C++' was adopted in 1983, signifying the language's evolutionary improvement, as '++' is the increment operator in C. C++ was standardized by the International Organization for Standardization (ISO) in 1998 and has continued to evolve, incorporating modern features and improvements.

  • Developed by Bjarne Stroustrup at Bell Labs in 1979.
  • Originally called 'C with Classes'.
  • Designed to enhance the C language with object-oriented features.
  • Officially named C++ in 1983, symbolizing the evolutionary nature of the language.
  • Standardized by the International Organization for Standardization (ISO) in 1998.
  • Continues to evolve with modern features and improvements.

Installing a C++ Compiler

To write and execute C++ programs, we need a compiler. A compiler translates your C++ code into machine code that the computer can understand and execute. Some popular C++ compilers include GCC (GNU Compiler Collection), Clang, and Microsoft Visual Studio. Let's go through the installation steps for each of these compilers.

  • A compiler translates your C++ code into machine code that the computer can execute.
  • Popular C++ compilers:
    • GCC (GNU Compiler Collection)
    • Clang
    • Microsoft Visual Studio
  • Installation steps for each compiler:
    • GCC: Install via MinGW or directly on Linux
    • Clang: Available via official website or package managers
    • Visual Studio: Download and install from the Microsoft website

Installing GCC (Windows with MinGW)

To install GCC on Windows, we use MinGW. First, download MinGW from the official website. Run the installer and select 'Basic Setup'. Mark 'mingw32-gcc-g++' for installation. Apply the changes and wait for the installation to complete. Finally, add MinGW to the system PATH. You can verify the installation by opening Command Prompt and typing 'g++ --version'.

  • Download MinGW from the official website.
  • Run the installer and select 'Basic Setup'.
  • Mark 'mingw32-gcc-g++' for installation.
  • Apply changes and wait for the installation to complete.
  • Add MinGW to the system PATH.
  • Verify installation by opening Command Prompt and typing 'g++ --version'.

Installing Clang

To install Clang, download it from the official LLVM website and follow the installation instructions provided for your operating system. On macOS, you can easily install Clang using Homebrew by running 'brew install llvm'. Verify the installation by opening your terminal and typing 'clang --version'.

  • Download Clang from the official LLVM website.
  • Follow the installation instructions provided for your operating system.
  • On macOS, you can install Clang via Homebrew with 'brew install llvm'.
  • Verify installation by opening your terminal and typing 'clang --version'.

Installing Microsoft Visual Studio

To install Microsoft Visual Studio, visit the Microsoft Visual Studio website and download the installer. Run the installer and select the 'Desktop development with C++' workload. Follow the on-screen instructions and wait for the installation to complete. Once installed, open Visual Studio and create a new C++ project to verify the setup.

  • Go to the Microsoft Visual Studio website and download the installer.
  • Run the installer and select the 'Desktop development with C++' workload.
  • Follow the installation instructions and wait for the installation to complete.
  • Open Visual Studio and create a new C++ project to verify the installation.