I need to write a statserver.cpp that implements the items in this header file.
I am currently stuck on how to write my implementation for RetrieveData. Any help would be greatly apprieciated. I am on my second so around to fix this program.
Code:
#ifndef STATSERVER_H
#define STATSERVER_H
#include <cstdlib>
#include <iostream>
class StatServer;
void ReadData (StatServer& s);
// reads data from standard input and puts the read data into s
void DisplayData (const StatServer& s, std::ostream& os, char ofc = ' ');
// writes the data in s to the stream os with ofc preceding each data item
class StatServer
{
public:
StatServer () ;
~StatServer () ;
StatServer ( const StatServer& ) ;
StatServer& operator = ( const StatServer& ) ;
double Mean () const ;
double Median () ;
void Sort () ;
size_t Size () const ;
void SetData ( const int * data , size_t size ) ; // sets internal dat\
a
void RetrieveData ( int * data ) const ; // gives client a copy of internal
// data
private:
size_t size_;
int * data_;
bool sorted_;
static void Swap (int& x, int& y);
};
#endif
Comment