It keeps saying "Function definition is not allowed here".
int searchList(int list[], int numElems, int value)
{ //Around here
int index = 0;
int position = -1;
bool found = false;
while (index < numElems && !found)
{
if (list[index] == value)
{
found = true;
position = index;
}
index++;
}
return position;
}//And here
Where else am I supposed to put it?!
//prototype:
int searchList(int [], int, int);
//Call main:
cout<<"Enter an employee number for your search: "<<endl;
results = searchList(empId, SIZE, 7895122);
Please edit your post and put code tags around your code. Then I'll help you fix your problem.
Example on how to use the tags:
1 2 3
|
bool Chunk::layerExists(int layer) const {
return (m_voxels.find(layer) != m_voxels.end());
}
|
http://i.imgur.com/Ff76KZt.png
Last edited on