hey, this program is supposed to display 50 random numbers, which is does already, average those numbers, find the maximum,minimum, and mode of the numbers. I haven't started on the mode yet, but i dont see why the other things don't work. Did I initalize it wrong?
#include<string>
#include<ctime>
#include<iostream>
using namespace std;
int main()
{
int random[50],numcount[60],counter=0,counter2=0,max=0,min=0,average,total=0,mode=0,range=0;
srand((unsigned)time(0));
min=random[0];
for(counter; counter<50; counter++)
{
random[counter]=rand()%50 + 1;
cout<<random[counter]<<endl;
}
for(counter; counter<50; counter++)
{
if(max<random[50]);
max=random[50];
}
for(counter; counter<50; counter++)
{
if(min>random[50]);
min=random[50];
}
for(counter; counter<50; counter++)
{
numcount[random[50]]++;
}
for(counter; counter<50; counter++)
{
total=total+random[50];
}
average=total%50;
range=max-min;
cout<<"Average= "<<average<<endl;
cout<<"Maximum= "<<max<<endl;
cout<<"Minimum= "<<min<<endl;
cout<<"Range= "<<range<<endl;
cout<<"Mode= "<<mode<<endl;
system("pause");
return(0);
}