For my C++ class we have to make a program that outputs a histogram based on 25 random numbers and show the average, mode, range, minimum number, and maximum number.
The lesson we are currently in is vectors so therefore I have to use them.

Here's what I have so far...

Code:
#include<a:mylib.h>
#include<lvp\vector.h>



void histogram()
{
  vector<long>num((26));
  for(int y=1;y<num.length();y++){
  num[y]=1+random(50);


 }
 cout<<" 1-5: ";
 for(y=0;y<num.length(); y++){
 if(0<num[y] && num[y]<=5)
 cout<<"*";
  }cout<<endl;
  cout<<" 6-10: ";
  for(y=0;y<num.length();y++){
  if(6<=num[y] && num[y]<=11)
  cout<<"*";
   }cout<<endl;
   cout<<"11-15: ";
   for(y=0; y<num.length();y++){
   if(11<=num[y] && num[y]<=15)
   cout<<"*";
    }cout<<endl;
    cout<<"16-20: ";
    for(y=0; y<num.length();y++){
    if(16<=num[y] && num[y]<=20)
    cout<<"*";
     }cout<<endl;
     cout<<"21-25: ";
     for(y=0; y<num.length();y++){
     if(21<=num[y] && num[y]<=25)
    cout<<"*";
       }cout<<endl;
       cout<<"26-30: ";
       for(y=0;y<num.length();y++){
       if(26<=num[y] && num[y]<=30)
       cout<<"*";
	}cout<<endl;
	cout<<"31-35: ";
	for(y=0; y<num.length();y++){
	if(31<=num[y] && num[y]<=35)
	cout<<"*";
	 }cout<<endl;
	 cout<<"36-40: ";
	 for(y=0; y<num.length();y++){
	 if(36<=num[y] && num[y]<=40)
	 cout<<"*";
	  }cout<<endl;
	  cout<<"41-45: ";
	  for(y=0; y<num.length();y++){
	  if(41<=num[y] && num[y]<=45)
	  cout<<"*";
	   }cout<<endl;
	   cout<<"46-50: ";
	   for(y=0; y<num.length();y++){
	   if(46<=num[y] && num[y]<=50)
	   cout<<"*";
  }
}

void maxmin()
{
int y,z,x;

  for(y=0; y<50; y++){
  y=z;

   for(y=50; 0<y; y++){
   y=x;

}


void average()
{
int y,a;
double sum;
  sum=0;
  for(y=0; y<num.length(); y++){
  sum+=num[y];
  a=sum/25;
 }
}


void mode()
{
  int y;
  vector<long>num((51,0));
  for(y=0; y<num.length(); y++)
  cout<<(num[y])++;
}



void main()
{
  int y,a,x,z;
  clrscr();
  randomize();
  cout<<num[y];
  histogram();
  maxmin();
  cout<<x;
  cout<<z;
  cout<<(z-x);
  average();
  cout<<a;
  mode();
}
}}
I've been getting these errors:
*Declaration Syntax at Top bracket in the average function
*Declaration Missing ; at last bracket of the main block

I've been trying everything and I still can't find what is up. Also I would like to know if I'm doing my program right so far. Also sorry for the program being kinda everywhere. When I try to fix things in a program the program usually ends up this way...

Any help would be appreciated