I want to write a function that will take an array of integers and determine the mode of those integers. Can anyone help out ?
If someone could show me an example I would be forever grateful.
Thanks a ton.
Printable View
I want to write a function that will take an array of integers and determine the mode of those integers. Can anyone help out ?
If someone could show me an example I would be forever grateful.
Thanks a ton.
void foo( int bar[], int arraysize )
It's fairly simple. You'd be best served using two arugments, one to denote the size of the array you are passing.
Quzah.
Do a search on this board, there have been many discussions on this topic. One such is this one.
What I've set up is to prompt the "user" for the number of test subjects that were surveyed.
I then dynamically create the array of integers with that many elements.
I then prompt the user to input into the array the number of movies the test subjects watched.
I then calculate the average, median, and the mode of the values entered.
average(); works fine
median(); works fine
its the mode() that I'm just not getting.
Hey thanks alot guys, I really appreciate it.
hk_mp5kpdw thanks for the link, I would never have thought about using vectors.