I have forgotten
my Password

Or login with:

  • Facebookhttp://facebook.com/
  • Googlehttps://www.google.com/accounts/o8/id
  • Yahoohttps://me.yahoo.com
get GPL
COST (GBP)
this unit 0.50
sub units 4.00
+
0

Mode

Finds the most common value in an array.
Controller: CodeCogs

Dependents

Info

Interface

C++

Mode

 
template<class T> Tmodeintn
T*data )
This function calculates the most common value in an array of data. Like Stats/Moments/Median, mode is a location measure.

Example:

#include<iostream>
#include <codecogs/statistics/moments/mode.h>
int main()
{
  double x[11]={4, 4, 5, 5, 5, 8, 8, 8, 8, 9, 9},
  res=Stats::Moments::mode(11, x);
  std::cout<<"The mode of the x array is:"<<res<<std::endl;
  return 0;
}

Output:

The mode of the x array is: 8

Parameters

nthe size of the array
datathe actual array of data

Returns

the most common value in the given array of data

Authors

Anca Filibiu (August 2005)
Source Code

Source code is available when you agree to a GP Licence or buy a Commercial Licence.

Not a member, then Register with CodeCogs. Already a Member, then Login.