Lab7 - Thomas Nanke CIS 200-001 CIS 200L-001 Lab #7 Class...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
Thomas Nanke CIS 200-001 CIS 200L-001 Lab #7 Class Template and Function Template 3/17/08
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
The Machine type that I used is the PC with Microsoft XP Professional as the operating system. The compiler type is the Microsoft Visual 6.0 Compiler. The goal of this lab was to write a template function that takes an unsorted array and its length as parameters, and design this function so that it returns the median of the array. I created a class template and threw in a sorting algorithm, so my plan was to sort the array first, pass it to a GetMedian function, and use that function to return the median. I ran into a problem that I absolutely could not solve, however. My program compiled without errors, but I kept getting errors in trying to link my program. Unresolved Externals being caused by my function calls in the main were my problem. I would really love to know what I’ve been doing wrong; I simply couldn’t figure it out. Here is a copy of my source code #include <iostream> using namespace std; template <class ItemType> class T { public: T( unsigned sz ); ~T(); bool IsOdd(int n) const; bool IsEven(int n) const; inline void Sort(ItemType values[], int first, int last);
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 6

Lab7 - Thomas Nanke CIS 200-001 CIS 200L-001 Lab #7 Class...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online