CS3520: Programming in C++

Home

Development

General Guidelines

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).

Development Environment Setup

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.

VS Code + Khoury Linux Remote

VS Code Settings

After installing VS Code, it is recommended to change these settings. You may need to change them in both "User" and "Remote" settings.

Khoury Linux SSH (command line)

You can check your assignment on Khoury Linux using SSH. Open a terminal (e.g. in VS Code) and enter the following commands.

GitHub Classroom

We will be using GitHub Classroom for assignments and assignment turnin.

To accept an assignment:

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.

VS Code IDE

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:

To build, from the menu, choose "Terminal" -> "Run Task..." to:

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):

If you run into issues, please check the FAQ.

Running and Testing Your Programs

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]

In-class Exercises

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.

Development Tools

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).

Some useful commands for gdb (or lldb if different) are given here:

valgrind (memcheck): More information can be found in the Valgrind documentation.

gcov: More information can be found in the Gcov documentation.

callgrind: More information can be found in the callgrind documentation.

CxxTest: More information can be found in the CxxTest repo and CxxTest guide.

Frequently Asked Questions (FAQ)

Moved here.