lab7 - #include u using namespace std; template...

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

View Full Document Right Arrow Icon
#include <iostream> # using namespace std; u 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); //my Sort function uses the split and swap functions that I have defined. I wanted //to sort the unsorted arrays before I passed them into the GetMedian function. void Split(ItemType values[], int first, int last, int& splitPt1, int& splitPt2); inline void Swap(ItemType& item1, ItemType& item2); void Print(ItemType A[]); ItemType & operator[](unsigned i); bool operator<(T other) const; ItemType GetMedian(ItemType A[],int n); private: ItemType* values; unsigned size; ItemType med; }; } template<class ItemType> T<ItemType>::T( unsigned sz ) { values = new ItemType [sz]; size=sz; } template<class ItemType> T<ItemType>::~T() { delete [] values; } { return values[i]; } template<class ItemType> bool T<ItemType>::operator<(T other)const
Background image of page 1

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

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 04/25/2010 for the course CECS CIS 200 taught by Professor Jieshen during the Winter '08 term at University of Michigan-Dearborn.

Page1 / 4

lab7 - #include u using namespace std; template...

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

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