Assignment 0: Hello CS223!

Due Thursday, September 8, before midnight

The goals for this assignment are:

  • Try slack

  • Sign-up for Github

  • Look at the website

  • Write a simple C program

  • (Optional) Setup your development environment on your own machine

1. Try slack

I will be inviting you all to join the course slack channel. In the introduction channel, say and introduce yourself:

  • What is your preferred name and pronouns?

  • Share with us your favorite emojji. :)

We will use Slack for

  • Course announcements

  • Links to zoom and calend.ly

  • Questions and errata for assignments and labs

You can also use Slack to talk directly to me and the TAs, or even to each other!

2. Sign-up for Github

Please go to github.com and register. We will use github for assignments. Email the instructor (anormoyle at brynmawr.edu) with your github username.

*You will need to setup an SSH key for Github. Click here for instructions.

We have made the decision to open-source our assignments and projects for this class. The benefit of this decision is that you will have a portfolio of work that you can easily keep and share.

Having open-source assignments means that your work is publicly viewable, should someone search for it. It also means that if you copy other people’s work, it is in plain view for anyone to see! We will compare assignments and expect everyone to adhere to the honor code at Bryn Mawr and Haverford.

You will discover that there are many open-source coding resources for online. Some of it is boiler plate and intended to be re-used, such as when we use API documentation in order to use a function. Any non-trivial code (longer than a single statement) that you re-use in your own program should be attributed. In this class, 99% of all code should be your own.

3. Read the class web pages

Start by reading through all of the class webpage! Bookmark this page on your browser, or use some other method that helps you keep this information handy. All course materials will be posted on the course webpage!

Pay special attention to the Schedule.

4. Hello C

Verify that you can use Github, git, and C. You can try this using a lab machine, or your own machine if you have setup your development environment there.

Fork the repository

Fork the repository from here:

Fork is a button located on the top, right on Github.

Clone the repository

From your own account, clone the repository you just forked. The URL should look something like the following

git@github.com:<YOURUSERNAME>/assignments[]

Use the "Code" button on Github to copy the URL. Then run the following command from terminal.

git clone git@github.com:<YOURUSERNAME>/assignments[]

This will download a local account of the repository to your computer.

Build hello.c

In the directory A00, you will have a sample file, hello.c and makefile Makefile. Try building and running.

$ make hello
$ ./hello
Hello World

Fortune

In the directory, A00,

  • implement a new program, fortune.c that modifies hello.c to print a fortune of your choosing. Your program should compile and run like so:

$ make fortune
$ ./fortune
A journey of a thousand miles begins with a single step.

Submit your work

Add and check in your program using git and then push your changes to Github. Run the following command inside your A00 directory.

$ git status
$ git add fortune.c Makefile
$ git status
$ git commit -m "assignment 0 exercise"
$ git status
$ git push
$ git status

Run git status to check the result of the previous git command. Check the Github website to make sure that your program uploaded correctly.

5. (Optional) Set up your own development environment

Having your own development environment will allow you to write code outside of lab.

All programs must run on the lab’s Linux environment. Make sure you test your work on the lab machines if you work on your laptop!

5.1. Windows

  1. Open PowerShell and install wsl2: wsl --install. See documentation. Note that you may need to open powershell as an administrator.

  2. From the windows store, install Ubuntu.

Once installed, you can setup your development environment from a bash shell.

  1. Open PowerShell

  2. Type wsl to start the windows subsystem for linux. This will give your a bash prompt

  3. Then install your development tools

    1. sudo apt-get install cmake

    2. sudo apt-get install git

    3. sudo apt-get install g++

    4. sudo apt-get install vim

    5. sudo apt-get install libc6-dev-i386

    6. sudo apt-get install gcc-multilib

    7. sudo apt-get install hexedit

    8. sudo apt-get install valgrind

    9. sudo apt-get install gdb

For example, you get something like the following

Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.

PS C:\Users\alinen> wsl
WSL alinen@Balthazar:~$ sudo apt-get install make

etc
A quick way to open powershell is to type <WindowsKey>-'Q' and type 'powershell'.

5.2. MacOS

From terminal, run command xcode-select --install

You can follow the instructions here

Then, to install additional dependencies, execute the following commands form terminal

$ brew install vim
$ brew install git
$ brew install hexdump
$ brew install cmake
A quick way to open terminal is to use spotlight. From the keyboard, type the <cmd> and <spacebar>. Then type terminal at the popup edit field.

Unfortunately, valgrind and gdb cannot be run natively on mac.