|
typedef vector <Record *> :: iterator iter;
iter StuInfoVec :: findRecord (const string&pattern, int type, iter from)
{
/ * Function: Find a record from the record information
Parameters: pattern, the specified field of the record to be searched is equal to pattern.
type, 0 means that the student number of the record you are looking for is equal to pattern.
A value of 1 indicates that the name of the record you are looking for is equal to pattern.
A value of 2 indicates that the rank of the record to be found is equal to pattern.
from, looking for a matching record starting from from.
Returns: if found, returns an iterator to the first matching record
If not found, the iterator returned is equal to the value returned by pastEnd ()
Note: from should be a dereferenceable iterator. The first call is available first (),
After that, the value of the previous findRecord () is incremented by 1 and until pastEnd () is returned, all matching records can be obtained * /
iter it;
iter it_end = recVec.end ();
for (it = from; it! = it_end; it ++)
{
// Find records matching pattern based on the type of type
switch (type)
{
case 0:
if (pattern == (* it)-> number)
return it;
case 1:
if (pattern == (* it)-> name)
return it;
case 2:
if (pattern == (* it)-> index)
return it;
default:
cout << "No such query" << endl;
}
}
}
syntax error: missing ';' before 'tag :: id'
error C2501: 'iter': missing storage-class or type specifiers
fatal error C1004: unexpected end of file found
The corresponding header files are defined, these errors always occur, I do not know why, please help experts |
|