|Assigned||16 Sep 2016 @ 16:59h|
|Due||23 Sep 2016 @ 23:59h|
Warm up your programming skills and make sure you can submit assignments though Subversion.
In this first assignment, you need to recall how to write a function that deals with local variables and an array. You will also need to learn how to submit code through the revision control system called Subversion. We will explore Subversion in Lab 1, but in the meantime, you should read the first two parts of Lab 1’s “Theory” section.
Remember, assignments are individual work: you must complete the assignment yourself.
Start with the following header file:
This file contains the declaration for the
You should define this function in a file called
The function that you wrote won’t do much by itself: it needs to be incorporated into a larger program. This program might be a large, complex application with a sophisticated user interface and lots of “moving parts” — this can make it difficult to test that your code is working correctly. One approach to make testing more practical is to test small units of code by themselves, hence the name unit testing.
We will employ a unit testing approach for “real” assignments, but for this
test assignment we can approximate the approach by compiling
together with the following test code:
You can write your assignment code in a C++ IDE if you like, but I would also encourage you to explore the command line (and I will require it in the labs). To compile your C++ function into a complete program at the command line, type:
engi3891$ c++ -std=c++11 average.cpp test0.cpp -o test
Here’s what this command line means:
g++on some versions of Linux or using the MinGW environment on Windows.
Finally, you can run the resulting test program by running
You should see output like this:
engi3891$ ./test The message you have chosen to display is: 'Hello, world!'.
You should submit your code to your personal Subversion directory
This directory is for your individual work, and
assignments are individual work.
svn add and
svn commit commands from
to put the
average.cpp files into a directory called
assignments/0/ within your personal directory.
After you commit your work, you shold receive a confirmation email
and you should be able to see your submitted work in a browser at