CSCI 160 Lab exercise 2, F21N01/N02

In lab exercise 2 we'll start gettting into significantly larger programs than in lab 1, so following good coding practices becomes much more important (incremental design, following code standards).

As with lab 1, there are several key syntax elements you'll need to be familiar with. The core part 2 syntax elements can be found here.

Again, you'll be following similar steps as in lab 1 except that you'll be creating and working in labex2.

Refer back to the lab1 part 1 instructions if you forget the specifics of different steps.


labex2.cpp objectives

In this lab exercise we want to practice the development and use of our own functions, and the use of if/else to apply error checking to user input (either through checking cin.fail() or through checking scanf's return value).

The applied objective for this exercise is to create and submit a complete and correct C++ program, adhering the the course code standards, with the following behaviour and restrictions:

  1. The bulk of the program functionality will be carried out by four functions (to be written/implemented by the student):

  2. The main routine's sequence of events will be to
Note: you may use either the iostream (cin/cout) or the cstdio (scanf/printf) approach for I/O, but pick one approach or the other, don't mix and match.


Deadlines and late penalties

Submission deadlines and late penalties for all lab exercises are provided on the main labs page.

Reminders

Don't forget to do your "make submit" when finished, and don't forget about the tools/tips from week 2 of labex1 (ssh'ing to the pups, getting your lab feedback, and use of X2Go).

Don't forget the code standards, particularly those for indentation, variable and constant naming, layout and function prototypes, and appropriate commenting of your code.

Remember you must be in the correct directory, e.g. csci160/labex1, whenever you are working on the program, otherwise the necessary makefile and source code files are not present.

If you're unsure which directory you are in, enter the command
pwd
If you find you are in an incorrect directory then you can jump directly to the labex1 directory using the following command:
cd ~/csci160/labex2

Suggested (iterative) development process

As with lab1, I strongly recommend adding and testing small parts of the program at a time.

(I've posted an example of the first few steps in case folks are having trouble getting started.)