#include #include #include #include using namespace std; int main() { //unsigned c = 0; //int n = 0; ////while( (cin >> n).good() ) //while( cin >> n ) //{ // ++c; //} //cout << "You entered: " << c << " integers." << endl; // load a vector of integers from the console. vector v; int n; while( cin >> n ) v.push_back( n ); cout << "You entered: " << v.size() << " integers" << endl; sort(v.begin(), v.end()); vector::iterator vMin, vMax; vMin = v.begin(); cout << "The minumum value in the vector is: " << *vMin << endl; vMax = v.end() - 1; cout << "The maximum value in the vector is: " << *vMax << endl; double median; if (v.size() % 2 == 0) { median = (v[(int)(v.size()/2.0-1)] + v[(int)(v.size()/2.0)])/2.0; } else { median = v[v.size() / 2]; } cout << "The median of the vector is: " << median << endl; //Find the Mean double sum = 0; double mean; for(size_t i = 0; i < v.size(); ++i) sum += v[i]; mean = (double)sum / v.size(); cout << "The arithmetic mean is: " << mean << endl; sum = 0; double variance; for(size_t i=0; i < v.size(); ++i) sum += pow (v[i] - mean,2); variance = sum / (double) v.size(); cout << "The variance of the vector is: " << variance << endl; double standardD = sqrt(variance); cout << "The standard deviation of the vector: " << standardD << endl; map frequencyCount; //This is my attempt to increment the values of the map everytime one of the same numebers for(size_t i = 0; i < v.size(); ++i) frequencyCount[v[i]]++; unsigned currentMax = 0; unsigned checked = 0; unsigned maax = 0; for(auto it = frequencyCount.cbegin(); it != frequencyCount.cend(); ++it ) //checked = it->second; if (it ->second > currentMax) { maax = it->first; } //if(it ->second > currentMax){ //v = it->first cout << " The highest value within the map is: " << maax << endl; }