compiling error: expected primary expression

I am pretty new with c++, but I have a pretty decent grip on the basics (I think.) I cannot get the following code to compile (I'm only posting the section that gets the error). The errors read as the following:


pa1.cc: In function ‘int main()’:
pa1.cc:53:27: error: expected primary-expression before ‘target’
pa1.cc:53:35: error: expected primary-expression before ‘bool’
pa1.cc:53:48: error: expected primary-expression before ‘int’
pa1.cc:55:27: error: expected primary-expression before ‘target’
pa1.cc:55:35: error: expected primary-expression before ‘bool’
pa1.cc:55:48: error: expected primary-expression before ‘int’


and I have put two stars by the else if statements that are getting the error:

int main(){
//PRE: none
//POST: The menu has been displayed and the user has input the menu
// selection they wish to execute.

AList B;
element selection;

selection = B.DisplayMenu ();

if (selection == 1)
B.Read ();
else if (selection == 2)
B.GenerateRandomList ();
else if (selection == 3)
B.BubbleSort ();
else if (selection == 4)
B.InsertionSort ();
else if (selection == 5)
B.SelectionSort ();
**else if (selection == 6)
B.LinearSearch (element target, bool &found, int &position);
**else if (selection == 7)
B.BinarySearch (element target, bool &found, int &position);
else if (selection == 8){
cout << "Quitting Sort and Search Demo Program, v1.0.";
return 0;
}
else {
cout << "Not a menu option. Please select an option from the ";
cout << "menu.";
selection = B.DisplayMenu ();
}
}


Thanks!
1
2
3
4
5
6
7
int main()
{
  AList B;
  B.LinearSearch (element target, bool &found, int &position); // error

  return 0;
}

This code calls a function on line 4. However, this is not the syntax to pass parameters to a function. Reread "this is how function is declared, this is how function is called" material.
Topic archived. No new replies allowed.