| |

VerySource

 Forgot password?
 Register
Search
View: 861|Reply: 8

Everyone help to see what's wrong with this program, hurry

[Copy link]

2

Threads

7

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

Post time: 2020-2-14 10:00:01
| Show all posts |Read mode
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
Reply

Use magic Report

0

Threads

37

Posts

28.00

Credits

Newbie

Rank: 1

Credits
28.00

 China

Post time: 2020-4-14 11:45:01
| Show all posts
See if there are more brackets and fewer brackets, and then there is a semicolon after the class definition
Reply

Use magic Report

0

Threads

49

Posts

34.00

Credits

Newbie

Rank: 1

Credits
34.00

 United States

Post time: 2020-4-14 21:00:02
| Show all posts
default has no return
Reply

Use magic Report

0

Threads

49

Posts

34.00

Credits

Newbie

Rank: 1

Credits
34.00

 China

Post time: 2020-4-14 23:15:01
| Show all posts
Sorry, it should be that if both are default, there is no return
Reply

Use magic Report

0

Threads

49

Posts

34.00

Credits

Newbie

Rank: 1

Credits
34.00

 China

Post time: 2020-4-15 01:45:01
| Show all posts
If not found, the returned iterator is equal to the return value of pastEnd ()
-------------------------------------------------
Haha, did you see the return value
Reply

Use magic Report

0

Threads

24

Posts

9.00

Credits

Newbie

Rank: 1

Credits
9.00

 China

Post time: 2020-4-15 15:45:01
| Show all posts
iter it;
iter it_end = recVec.end ();
I wonder if you have overloaded assignment ...
Reply

Use magic Report

0

Threads

24

Posts

9.00

Credits

Newbie

Rank: 1

Credits
9.00

 China

Post time: 2020-4-15 16:15:02
| Show all posts
What about that tag :: id
Reply

Use magic Report

2

Threads

7

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

 Author| Post time: 2020-4-18 10:45:01
| Show all posts
tag :: id I do n’t know what ’s going on, nor do I define what id
Reply

Use magic Report

2

Threads

7

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

 Author| Post time: 2020-4-18 15:30:02
| Show all posts
But if you comment out this function, there is nothing wrong, so it must be wrong here
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list