From f2566da91396bc07356601794fd5db858a78f1f3 Mon Sep 17 00:00:00 2001 From: Michael Abed Date: Sat, 3 Mar 2012 23:32:27 -0500 Subject: make basically everything work --- get_mean.cpp | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'get_mean.cpp') diff --git a/get_mean.cpp b/get_mean.cpp index e69de29..f62f606 100644 --- a/get_mean.cpp +++ b/get_mean.cpp @@ -0,0 +1,25 @@ + +#include "statistics.h" + +using namespace std; + +float get_mean(const char *filename) +{ + ifstream in; + in.open(filename); + + int count = 0; + float sum = 0; + + int cur = 0; + + while (!in.eof()) { + in >> cur; + sum += cur; + count++; + } + + in.close(); + + return sum/count; +} -- cgit v1.2.3