These guidelines apply to all assignments unless otherwise specified in the assignment. Guidelines not followed may result in points off.
Make sure to check the rubric provided with each assignment for grading information. Also fill out the ABOUT.txt in each assignment.
For programs that read in particular types of numbers (ie, integers), you can use the standard iostream handling for that type of input, unless otherwise specified.
Credit, even for group work, is assigned based on commit history. If a group member has no code commits from their class GitHub username, they may receive a 0.
Code that does not build or does not run may receive a 0.
Up to -10: You should generally only turn in / push the files included in the initial assignment. Don't commit extraneous files, such as additional executable or object files.
Up to -10: There are no specific style guidelines for coding, but code should be well-indented and commented as needed. Code that is especially hard to follow may result in points off. Commit messages that are not meaningful may result in points off.
Up to -50: When writing your code, you should not:
Up to -100: If you have no commits to your repo from you class GitHub username you may not receive credit.
-10-50: Memory errors (e.g. as reported by valgrind) may result in additional points off.
+5: Anyone who finds a new discrepancy between the assignment instructions and reference implemenation, reported to the instructor via email, and requests extra credit for it, will receive 5 extra credit for the assignment (subject to the instructor's discretion).
Assignments will be graded on Khoury Linux. It is highly recommended to check your code on Khoury Linux! Information on other platforms is provided for convenience but they may not work with all assignments or may produce different results.
If you need a Khoury account you can request one here.
While we will generally be using Visual Studio Code for assignment development, all assignments are set up to build with a Makefile and you can use the command line if you prefer. All assignments should be completable on the command line using the Khoury Linux setup. If you are familiar with ssh you can use that to connect without a GUI. Follow these instructions.
Visual Studio Code Remote - SSH extension (use the 4 box icon on the VS Code sidebar)
Set up the remote:
Remote-SSH: Connect to Host...
Choose + Add new SSH host...
Enter [Khoury username]@login-students.khoury.northeastern.edu
Select the top configuration file
If a box shows up in the bottom right, click Connect
Enter your password
Choose Terminal -> New Terminal
Enter echo "source scl_source enable gcc-toolset-12" | tee --append ~/.bash_profile ~/.bashrc into the terminal window
Install the C/C++ extension on the remote (use the 4 box icon on the VS Code sidebar)
Close VS Code
Remote-SSH: Connect to Host... to connect; VS Code may try to connect to the remote automatically when you start
which g++ and it should print /opt/rh/gcc-toolset-12/root/usr/bin/g++.
After installing VS Code, it is recommended to change these settings. You may need to change them in both "User" and "Remote" settings.
You can check your assignment on Khoury Linux using SSH. Open a terminal (e.g. in VS Code) and enter the following commands.
ssh -l [Khoury username] login-students.khoury.northeastern.edu
scl enable gcc-toolset-12 bash
git clone https://github.com/cooperclasses/[your repo name]
cd [your repo name]
python3 test.py
cat test.log
cd ..
rm -rf [your repo name]
We will be using GitHub Classroom for assignments and assignment turnin.
To accept an assignment:
https://classroom.github.com/x/xxxxxxxx).
Log in and authorize GitHub Classroom if needed. You'll need a GitHub account, and can make a new one for class if you'd prefer.
Accept the assignment by joining an existing team or creating a new one. If you are working in a group, make sure to coordinate with your group members to create and join the correct team! If you are working individually, you'll still need to make a team for yourself.
This will make a repository with a copy of the starter code that you can use for the assignment (like https://github.com/cooperclasses/[reponame]).
Further information about using git and GitHub can be found here:
git commands tutorial
git branching tutorial
EGit (tutorial)
At some point after the semester the turnin repositories and teams will be deleted from GitHub.
Assignments will come set up for VS Code, with related tasks. These will generally just call the provided Makefile, which will be used to build your program for grading. VS Code can be used to get, edit, build, and turn in the assignments.
In VS Code, you can clone your assignment repository:
https://github.com/cooperclasses/[reponame]) in the text entry.
Choose the local folder where you'd like to clone the assignment to.
You can either log in using the text entry at the top, or authorize VSCode to access your GitHub account.
To build, from the menu, choose "Terminal" -> "Run Task..." to:
make all: build all programs
make [program]: build the program [program]
make clean: remove all programs and intermediate files
To run a program directly, go to a terminal, or open a
terminal using "Terminal" -> "New Terminal", and
type ./[program]. To run the reference
implementation, type ./ref/[program] (with the
program suffix -linux on WSL and Linux
and -macos on macOS.
Note that on you can use Ctrl+D to send end-of-file to standard input, and Ctrl+C to stop the program.
Git commands can be used to update, share, and turn in assignments. They are accessed through the "Source Control" panel (the graph icon). Click on the "..." to access a menu.
Pushing your changes turns them in for the assignment. Grading will be based on the latest version of the assignment pushed before the deadline. Make sure to push your changes and not just commit them!
If you get a message about needing to configure your git username and email, open a terminal and enter these commands (leave the quotes around your information):
git config --global user.name "[GitHub username]"
git config --global user.email "[GitHub email@example.com]"
If you run into issues, please check the FAQ.
Most of the grade for most assignments will be based on comparing the output of your programs to a reference implementation. The reference implementation and test cases will be provided with the assignment. In most cases your program's output must exactly match the reference output to receive credit. Valgrind may also be used to check your programs for memory errors or leaks. Most of the tests will be provided with the assignment, however, additional tests may be used for grading.
The test script will try to build your programs, run them, and compare their output to the reference implementation.
The test script uses Python 3. You can run the test script using the test VS Code task, or running python3 test.py in a terminal.
Information produced by the test script, including program
inputs and outputs, is written to test.log. You
may need to refresh the project to get test.log to
show up the first time in Eclipse (this can be done by
right-clicking on the project and choosing Refresh from the
menu).
The format of test.log will look something like this:
***** testing suite [test suite name]
===== testing case [test case number]
----- running build: [build command]
----- returncode: [0 means success]
----- input
[input provided for this test case]
----- running tested implementation: [your executable name]
[output from your executable]
----- returncode: [0 means success]
----- running reference implementation: [reference executable name]
[output from reference executable]
----- returncode: [0 means success]
----- output [does / does not] match
----- test [passed / failed]
For in-class examples and exercises, code will be posted to Canvas in each exercise.
To to work on an exercise, connect to the Khoury remote as usual. Get the repo https://github.com/cooperclasses/cs3520-scratch.git if you do not have it.
Copy/paste the code from the Canvas exercise into scratch.cpp, and edit it according to the instructions. Use the "debug active file" task to run it.
When you are done, copy your code and paste it in the associated Canvas exercise. If you worked with a partner, you both need to paste your code in Canvas.
Don't include the square brackets when you use your values in the examples.
gdb / lldb: The debuggers can be run on the command line if needed. More information can be found in the documentation for gdb (or lldb).
gdb [program] or lldb [program]
Some useful commands for gdb (or lldb if different) are given here:
run
break [file]:[line] or break set -f [file] -l [line]
remove a breakpoint: clear [file]:[line] or break clear -f [file] -l [line]
list breakpoints: info break or break list
set breakpoint condition: condition [breakpoint-number] [condition-expression] or break modify -c "[condition-expression]" [breakpoint-number]
set breakpoint hit count: ignore [breakpoint-number] [hit-count] or break modify -i [hit-count] [breakpoint-number]
next
step into: step
step out: finish
continue: continue
info locals or v
stack trace: bt
source location: f
f [frame-index]
select one stack frame up: up
select one stack frame down: down
valgrind (memcheck): More information can be found in the Valgrind documentation.
valgrind ./[program]
gcov: More information can be found in the Gcov documentation.
./[program]
Run gcov (which should produce .gcov files): gcov [sourcefile]
Open a .gcov file to see the annotated source.
callgrind: More information can be found in the callgrind documentation.
valgrind --tool=callgrind ./[program]
View output from callgrind: callgrind_annotate --auto=no --inclusive=yes --show-percs=yes --threshold=100 callgrind.out.[id]
CxxTest: More information can be found in the CxxTest repo and CxxTest guide.
curl -o cxxtest.zip -LO https://github.com/CxxTest/cxxtest/archive/a19f85fdf90f97e16d6e3e7e3d2d68c31cd89e3c.zip
Unpackage the zip file: unzip cxxtest.zip
Rename the unpackaged folder: mv cxxtest-a19f85fdf90f97e16d6e3e7e3d2d68c31cd89e3c cxxtest
Remove the zip file: rm cxxtest.zip
cxxtest folder is in your repo top-level folder, and add it to your repo.