C++ Algorithm Function count()
C++ Algorithm count()function accepts 'val' as argument and compares for the occurrence of element 'val' in the range. The number of occurrence of that element is returned.
first: It is an input iterator to the first element in the range.
last: It is an input iterator to the last element in the range.
val: It is the element whose occurrence is being searched in the range.
The function returns the number of occurrence of the element 'val' in the range [first,last).
50 appear 3 times. 70 appear 2 times.
The number of times 6 appear is: 4
The complexity of the function is linear up to a distance between first and last element.
Some or all of the elements of the range are accessed
The function throws an exception if any of the argument throws one.