CS1411 - 160 - Programming Principles I, Spring 2005

Lab assignment 3


This weeks you will practice enums, for loops and functions.

Mandatory work

Your TA will check that you have done the following things (you may leave once their done) :


Download the program file lab3.cpp. Create a project and make sure you have this file in it (You may also use cut-n-paste if you can't work out the download, but do NOT retype it!).

Fix the program

Unfortunately, there are two functions missing in the program. Please add those functions. It should be possible without modifying the main function, but you may do so if needed.

The function enter_type displays a choice of starboxes from the user, lets her select one, and returns a starBoxType.

The function printhollowbox takes a size as parameter (you may assume 2 < size < 20) and prints a hollow box with a star-border. Example (for 5):

*   *
*   *
*   *

Optional work

Some other things that you might try:

  • Make the enter function failproof by adding a while loop
  • Add another choice, add a function for it
  • Make the program repeat itself, if so wanted by the use (do-while loop)


Please check the labs page on how to get started. There are instructions for visual studio (use version 6) and XCode

Please give the Macs a try. If you simply cannot work with them, go to PE 119, but let your TA know.

Sample programs

have moved to the examples page


For help: ask your TA! He is here to help you!

If the instructions are unclear or you have any other questions, please email me