Skip to content

Andioruser/cs106l-assignments

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CS106L Assignments

This repository contains starter code for Stanford CS106L, a course on Standard C++ programming.

Getting Started

Before getting started, a few prerequisites:

  • You will need Python 3.8 or higher on your computer. You can check by running python3 --version (python --version on Windows) in a terminal.
  • You will need an IDE you can code in. We encourage you to use VSCode for this class (see guide below), but you may use any IDE that you can comfortably write and compile C++ code in.
  • You will need Git. If you are using VSCode, you should already have this. You can check by running git --version in a terminal.

Next, download the starter code. Open up a terminal (if you are using VSCode, hit Ctrl+` or go to Terminal > New Terminal at the top) and run the following command:

git clone https://github.com/cs106l/cs106l-assignments.git

which will download the starter code into a folder cs106l-assignments. If you are using VSCode, you can then open up a VSCode workspace dedicated to CS106L:

cd cs106l-assignments && code .

and you are ready to go!

Fetching assignments

As we update existing assignments and release new ones, we will push updates to this repository. To fetch a new assignment, open up a terminal to your cs106l-assignments directory and run

git pull origin main

You should now have the latest starter code!

VSCode Setup Instructions

We recommend using VSCode to write C++ code for this class. See instructions below to setup VSCode/GCC for your machine.

Mac

Step One: Installing VSCode

Go to this link and download Visual Studio Code for Mac. Follow the instructions on this webpage under the section Installation.

Inside VSCode, head to the extensions tab and search for C/C++. Click on the C/C++ extension, and then click Install.

🥳 At this point you should successfully have VSCode on your Mac 👏

Step Two: Installing a C++ Compiler

  1. Check if you have Homebrew by running
    brew --version
    If you get something like
    brew --version
    Homebrew 4.2.21
    then skip step 2 and go to step 3. If you get anything else that looks sus then proceed to step 2!
  2. Run this command:
    /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
    which is going to download Homebrew🍺 which is a package manager. Woot woot.
  3. Run the following command:
    brew install gcc
    which is going to install the compiler (GCC).
  4. Make note of which GCC version Homebrew installs. In most cases, this will be g++-14. By default, the g++ command on Mac is an alias to the built-in clang compiler. We can fix this by running
    echo 'alias g++="g++-14"' >> ~/.zshrc
    to make g++ point to the version of GCC we just installed. Change g++-14 in the above command to whichever version of GCC you installed.
  5. Restart your terminal and verify that everything worked by running the following command:
    g++ --version

Linux

These instructions are for Debian-based distributions, like Ubuntu. Tested on Ubuntu 20.04 LTS.

Step One: Installing VSCode

Go to this link and download Visual Studio Code for Linux. Follow the instructions on this webpage under the section Installation.

Inside VSCode, head to the extensions tab and search for C/C++. Click on the C/C++ extension, and then click Install.

🥳 At this point you should successfully have VSCode on your Linux machine 👏

Step Two: Installing a C++ Compiler

  1. In a terminal, update the Ubuntu package lists by running
    sudo apt-get update
  2. Next install the G++ compiler:
    sudo apt-get install g++-10
  3. By default, the system version of G++ will be used. To change it to the version you just installed, you can configure Linux to use G++ version 10 or a higher version installed like so:
    sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-10 10
  4. Restart your terminal and verify that GCC was installed correctly. You must have a GCC version of 10 or higher:
    g++ --version

Windows

Step One: Installing VSCode

Go to this link and download Visual Studio Code for Windows. Follow the instructions on this webpage under the section Installation.

Inside VSCode, head to the extensions tab and search for C/C++. Click on the C/C++ extension, and then click Install.

🥳 At this point you should successfully have VSCode on your PC 👏

Step Two: Installing a C++ Compiler

  1. Follow the instructions at this link

    • You should be doing the instructions under Installing the MinGW-w64 toolchain.
  2. After fully following the instructions under Installing the MinGW-w64 toolchain you should now be able to verify everything worked by running the following command:

g++ --version

About

Course assignments for CS106L

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 65.5%
  • C++ 34.5%