1. You have a ; after the for loop, remove it. //EDIT: poster has reedited his code before I posted this.
2. replace -> with . in lines 23, 25, 27.
3. On line 29 you're trying to read a string into an int.
4. Line 34: You can't compare cin (std::istream) to a char. You want to read a character into a char variable, and then compare if the variable is equal to 'q';
5. Line 39, 42, 45, 48 You wanna put the a,b,c,d, into ' ' .('a','b'....)
6. Don't use system("pause"); http://www.cplusplus.com/forum/articles/11153/
Use cin.ignore(numeric_limits<streamsize>::max(), '\n'); instead (you gonna need to #include <limits> .
That's for syntactic errors. I didn't checked for any logical errors.
'pointer' is a terrible name for a variable, btw. Why not name it 'bops' or something?
What type of thing is pointer[i]? Is it a bop* or a bop?
(Remember, . is member resolution for structures, and -> is member resolution for pointers to structures.)
Line 34: This line makes no sense:
- cin will never be equal to 'q'.
- $$ does not mean anything.
- You are using choice before you get it from the user, on line 36.
- isalpha() returns a boolean, not a char. Why are you casting it?
Case tags, lines 39, 42, 45, and 48: I think you mean case'a':, etc.
I recommend that your menu() function be revised to perform the complete action of a menu:
char menu()
{
char choice;
// Display the menu
cout << "Benevolent Order of Programmers Report\n"" a. display by name b. display by title\n"" c. display by bopname d. display by preference\n"" q. quit\n""> "
<< flush;
// Get the user's choice
while (true)
{
cin >> choice;
cin.ignore( 1000, '\n' );
choice = tolower( choice );
if (string("abcdq").find( choice ) != string::npos)
break;
cout << "What? " << flush;
}
return choice;
}