CS 2620 Assignment #3 Summer 2003
How to handin.
Points : 35
Weight : 3%
Due : Friday May 21, 2004 @ 11:00 PM
Note : Late assignments will be accepted only with the instructor's pre-approval.
Marks will be awarded for comments, style,
readability, compiling and working correctly.
- [10] Dynamic Arrays
Write a program that will read and print polynomials. A polynomial is the sum of 1 or more terms. Since we do not know how many terms might be entered, we will use a dynamic array of terms. You will need to repeatedly expand the size of the array as you read new terms. Keep track of the number of terms read so that you will know how many to print out. Use the term library provided in $L/termStruct.
- [10] Function Pointers
Write a program which will print a table showing the sum of the following
functions for the numbers from 1 to 30 :
- x
- reciprocal(x)
- square(x)
- cube(x)
- square root(x)
- log10(x)
- ex
Your program MUST make use of a function called sum which
accepts a function pointer as a parameter. You must write appropriate
functions to calculate reciprocal, square and cube of x.
For the square root, log10 and e functions, write functions
which call the appropriate function from the cmath library.
Your output should be in a nice table with headings and nicely formatted using
fixed decimal with 3 decimal places for all output.
- [10] Vectors
Write a program that will read an unknown number of points from a file and store them in a vector of points. After the points have all been read, report how many points were read; the two points that are closest together and the two points that are furthest apart. Use the point library that you developed in assignment 2.
- [5] Object Oriented Design
Design a class to represent a course at the university. Decide what attributes and behaviours are needed. DO NOT implement this class. Only provide the design.
Assignment List | Prev | Next | Computer Science 2620
Department of Mathematics & Computer Science
University of Lethbridge Home Page