Visual C# 2005 Guide
Class Tasks

The program on the previous page involved the creation of a class. The page is quite long and focused as much on exploring the properties of sets as it is on how to create a basic class. A bit more practice with the following tasks will uncover some of the main pitfalls.

Having A Go

  1. Look back through the sorting algorithms. Combine all of the algorithms into a single class. The class should also create the random array when initialised. You will need methods for restoring the array to its unsorted state as well as for performing all of the different sorts.
  2. Write a class which includes two methods for finding the factorial of a number. One method should use iterative techniques, one recursive. Use the stopwatch component to compare the speed of execution of the two methods.