Lab 0: Autograder Setup and Intro to C++
Project due date:
This lab will be graded via the autograder. You must email me to get your autograder credentials.
Setting up a VM
If you are on Windows or want to set up a virtual machine, watch the video here.
If you are using Mac OSX consider setting up Homebrew–I use it and it is often very simple.
Getting the autograder
Follow the steps at the end of the previous video. Get the autograder by cloning the submission repo here. Be sure to read the instructions in that repository (in particular, read about how to make sure it’s working).
Get lab0
Create a new directory named lab0
somewhere on your system (e.g.,
~/projects/lab0
) and copy submit.py into that directory. Then run
submit.py and follow the steps it shows. You will need your
credentials (again, you get those by emailing me).
The autograder uses the directory name to decide which project to
download, so if you want to be working on lab 0, make sure your
directory is named lab0
.
Completing the lab
The task in the lab asks you to reverse an array. This should not be
too hard to figure out, and I show hints of it if you watch the intro
to C++ video. Basically, you want to loop over half the array and
exchange things at the right positions. As a hint, division in C++
truncates down (so 3/2 == 1
for integers).
If you need more help completing your lab, please be sure to read Part 1 of the C++ Tour (book available as free PDF).
Running the lab yourself
If you want to test your program as you go, you first need to compile it:
# Compile to a binary file named reverse
clang++ reverse.cpp -o reverse
And then run via…
# Actually run reverse
./reverse
Then you can type in a list of numbers. To end your typing type in control-D (i.e., hit D while holding down control). Your program will then calculate the output and print it.
You can also add extra tests of your own. Feel free to look at
test.py
to see how the tests are being run.