Statistics › Moments ›
Mode
Finds the most common value in an array.
Controller: CodeCogs
Contents
Dependents
Interface
C++
Mode
template<class T> Tmode( | int | n | |
T* | data | ) |
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
n the size of the array data the 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.