CS1411 - 160 - Programming Principles I, Spring 2005

Lab assignment 1

Motivation

This weeks you will practice recursion

Mandatory work

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

Implement the following functions in an iterative (non-recursive, using for-loops) and in a recursive way:

  • Given one number (> 1) as parameter, count from 1 up to that number. Example: 1 2 3 4 5
  • Given one number (> 1) as parameter, count from that number down to 1. Example: 5 4 3 2 1
  • Given one number (> 1) as parameter, count up to that number and then down again to 1. Example: 1 2 3 4 5 4 3 2 1

Each one of those should be a function, taking one int type parameter, returning void (there should be 6 total functions).

Add a main function that tests your code.

How?

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.

Help!

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