Hi 4 all..
i'm new in this fourm and i hope will be interested with u ..
i faind some problem i this program and i need yr help plllllllllz !
this is the link of the Q --> The Statistician Class
and this is what i do ..i really work so hard but still i didn't get it !!!
#include<iostream>
#include "stats.h"
using namespace std;
class statistician
{
public:
void statistician::next(double r)
{
if(coun==0)
{
count++;
total=r;
smallest=r;
largest=r;
}
else
{
count++;
total=total+r;
if(r<=smallest)
r=smallest;
if(r>=largest)
r=largest;
}
}
double mean()const
{
if (count > 0)
return total/count;
else
return -1;
}
double statistician::length()const
{
return count;
}
double statistician::recent()const
{
count=0;
smallest=0;
largest=0;
total=0;
}
double statistician::minimum()const
{
if(count>0)
return smallest;
else
return-1;
}
double statistician::maximum()const
{
if(count>0)
return largest;
else
return-1;
}
double statistician::abs_minimum()const
{
asser(length()>0);
x=p_abs(smallest);
y=p_abs(largest);
if(x>y)
{
return x;
}
else
return y;
}
double statistician::abs_maximum()const
{
asser(length()>0);
x=p_abs(smallest);
y=p_abs(largest);
if(x<y)
{
return y;
}
else
return x;
}
double statistician::statistician::sum()const
{
return total;
}
statistician operator +(const statistician& s, const statistician& t)
{
statistician c;
c.next(s.sum()+t.sum());
return c;
}
statistician operator *(double scale, const statistician& s)
{
return s;
}
};