Skip to content
Snippets Groups Projects
Commit 68fc9ffc authored by karter's avatar karter
Browse files

fixed everything Final Version

parent 9248e571
No related branches found
No related tags found
No related merge requests found
......@@ -58,6 +58,7 @@ double mean(vector<double> v)
}
double median(vector<double> v)
{
sort(v);
double median;
int location;
if (v.size() % 2 == 0)
......@@ -108,6 +109,7 @@ double max(vector<double> v)
}
double stdev(vector<double> v)
{
sort(v);
double ssq = 0;
double meanssq = 0;
for (size_t i = 0 ; i < v.size(); i++)
......@@ -120,6 +122,7 @@ double stdev(vector<double> v)
}
double percentile(vector<double> v, double p)
{
sort(v);
double fractpart, intpart = 0;
double rank = (p/100)*(v.size() - 1) + 1;
......
......@@ -39,7 +39,7 @@ int main()
//vector<double> data = {-1,2,10,3,4};
//vector<double> data = {-10,-100,-10000,2,3};
//vector<double> data = {6,7,8,9,10};
vector<double> data = {0.5,1.5,2.5,3.5};
vector<double> data = {0.5,-1.5,2.5,-3.5};
//vector<double> data = {1,1,2,2};
//vector<double> data = {1,1,1,2,2,2,3,3,3,4,4,4,5,5,5,6,6,6,7};
test_summarize(data);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment