### Thread: Arrays~

1. No Profile Picture
Contributing User
Devshed Newbie (0 - 499 posts)

Join Date
Sep 2003
Posts
90
Rep Power
11

#### Arrays~

//Sam Huang
//Cs 209-2393
//Arrays
//Prof. Borda
//Sept. 18,2003

#include <iostream>
using namespace std;
const int max=50;
void main();
{
int a[max];bool ok;
int n; float avg;
int n=22;
getdata (a[], n);
output (a[],n);
reverse (a[],n);
average (a[], n);
avg=average (a[], n);
cout<<"average"<<avg;
item=100;
ok=linearserach(a[]n, item);
if (ok) cout<<"yes":
else
cout<<"no";
return;
}

void reverse (int r[], int nn);
{
int i;
for (i=(n-1); i>=0;i--)
{
cout<<r[i]<<"";
float average (int r[]; int n)
{
int i; int sum;//sum=0
for (i=0; sum=0;i<<nn;i++)
{
sum=sum+r[i]
}
float temp sum;// floattemp= float (sum);
return (temp/nn);

sort (a].n);
void sort (int r[] int nn)
{
int [i]
for (j=0;j<(nn-1);j++)
if (r[j+1]j<r[j]
{
int T=r[j];
r[j]=r[j+1];
r[j+1]=t;
}
}//for j
}//for i
}//sort

}

got 2 errors..~

(11) : error C2447: missing function header (old-style formal list?)
(30) : error C2447: missing function header (old-style formal list?)
2. Remove the semicolons from the ends of the function headers (lines 10 and 29). They should not be there, you only do that in forward declarations (like in header files), not in the actual definition.

Clifford
3. No Profile Picture
Contributing User
Devshed Newbie (0 - 499 posts)

Join Date
Sep 2003
Posts
90
Rep Power
11
But when i remove it, i get like 22 erros...blah.!!
4. No Profile Picture
status unknown
Devshed Newbie (0 - 499 posts)

Join Date
Jun 2003
Posts
262
Rep Power
11
It doesn't necessarily mean you have 22 things wrong with your code. One single problem with your code can cause multiple compilation errors. Just work your way through the list of errors.

Note that you're calling functions inside main() that haven't been declared. If you add function prototypes to your program before main() it should help.