| |

VerySource

 Forgot password?
 Register
Search
View: 1910|Reply: 14

How to use vector as a parameter? Thank you!

[Copy link]

1

Threads

3

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

Post time: 2020-1-24 23:00:01
| Show all posts |Read mode
I wrote a function, such as void abc (vector <string>&VecStr, BOOL PutIn) I wonder why it is wrong in vc? How can I use a vector or a reference to a vector as a parameter? Thank you!
Reply

Use magic Report

0

Threads

23

Posts

13.00

Credits

Newbie

Rank: 1

Credits
13.00

 China

Post time: 2020-2-13 19:15:01
| Show all posts
Contains the required header files <vector> <string> <windows.h>,
If you don't want to write std ::, use namespace std
Reply

Use magic Report

0

Threads

49

Posts

34.00

Credits

Newbie

Rank: 1

Credits
34.00

 China

Post time: 2020-3-1 06:15:02
| Show all posts
Upstairs, <windows.h> is not necessary, not to write win32 programs
Reply

Use magic Report

0

Threads

73

Posts

46.00

Credits

Newbie

Rank: 1

Credits
46.00

 Invalid IP Address

Post time: 2020-3-1 11:45:02
| Show all posts
It may be necessary because the landlord uses a "BOOL".
When in, you can define it yourself.
Reply

Use magic Report

1

Threads

3

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

 Author| Post time: 2020-7-6 14:00:01
| Show all posts
Alas, I forgot to explain that my header file is absolutely no problem, do you think that besides the header file, my writing is not a problem?
Reply

Use magic Report

1

Threads

7

Posts

8.00

Credits

Newbie

Rank: 1

Credits
8.00

 China

Post time: 2020-7-6 18:15:01
| Show all posts
vector<string>&VecStr It seems that there should be a space in the middle, like this: vector<string>&VecStr
Reply

Use magic Report

0

Threads

41

Posts

28.00

Credits

Newbie

Rank: 1

Credits
28.00

 China

Post time: 2020-7-9 22:45:02
| Show all posts
There is no problem in writing. Is written like this
Reply

Use magic Report

0

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-8-3 21:15:01
| Show all posts
What's wrong
Reply

Use magic Report

0

Threads

12

Posts

10.00

Credits

Newbie

Rank: 1

Credits
10.00

 China

Post time: 2020-8-3 23:45:01
| Show all posts
Copy the void abc(vector<string>&VecStr,BOOL PutIn) of LZ and run it in VC without error
Is there any problem with the original poster's #include <vector>?
Reply

Use magic Report

0

Threads

24

Posts

7.00

Credits

Newbie

Rank: 1

Credits
7.00

 China

Post time: 2020-8-4 21:30:01
| Show all posts
BOOL, may be the reason for this, because BOOL is not a standard keyword, try to add
#define BOOL bool
See how
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