I am beginning C++ programmer, I have been taking my c++ class for about 5 months now and this is the first time I have been completely stumped and I know for a fact it wont be the last.
My professor assigned an assignment for us to find the mean, median and mode of an array of numbers. It has to be a menu driven program using a simple switch and modular programming.
Now I have everything working but the mode. I have tried to figure it out on my own for almost 2 weeks now, I have asked my professor, he pointed me in the right direction but I could still not figure it out.
Here is the block I am having trouble with.
void mode()
{
const int num = 10;
int i[num];
int p , MODE , count;
for (int foo = 0; foo < num; foo++)
{
cout << " Enter the numbers you wish to compute " << (foo + 1) << " : ";
cin >> i[foo];
}
for (int count = 0; count < num; count++)
cout << i[count] << " ";
cout << endl;
sort(i , num);
cout << " The values again sorted are : ";
for (int count = 0; count < num; count++)
cout << i[count] << " ";
cout << endl;
system("pause");
}
There is no function for mode in there yet however I do not know where to start. Any help would be greatly appreciated.
Thanks.
Tom