wow this is messy..
hmm here is an edited version of your code..
I dont have time to test/compile it. so dont blame me if doesnt work..
Code:
#include <iostream> //dont use .h use iso headers
#include <iomanip>
using namespace std;
int findCommon(int array[],int aray[],int number);
int main(void)
{
int numGrades;
int *grades;
int *freq;
cout<<"How many grades do you want to enter?<more than one please.>"<<endl;
cin>>numGrades;
grades=new int [numGrades];
freq= new int[numGrades];
for(int count=0;count<=numGrades;count++)
{
cout<<"Grade "<< count++ <<": ";
cin>>grades[count]; // I think this is what u meant?
}
cout<<"Grades :";
for (int index=0;index<=numGrades;index++)
{
cout<<setw(3)<<grades[index];
}
cout<<endl <<"The mode is: "<< findCommon(grades,freq , numGrades)<<endl;
return 0;
}
int findCommon(int grades[], int freq[],int numGrades)
{
int count=0;
for(int number=0;number<=numGrades;number++)
{
for (int compare=0;compare<=numGrades;compare++)
{
if (grades[number] == grades[compare])
{
count++;
}
}
freq[number]=count;
count=0;
}
int most=freq[0];
for (int k=0;k<=numGrades; k++)
{
if (most < freq[k])
{
most=freq[k];
}
}
return freq[most];
}
Luigi