Click here to Skip to main content
15,885,366 members
Please Sign up or sign in to vote.
3.00/5 (2 votes)
See more:
hi,how can i print the output of this?thanks




const std::vector<unum>&my_vector =agent.GetInfoState().GetPositionInfo().GetCloseTeammateToTeammate(2);</unum>


this doesnt work:
std::cout<<my_vector<<std::endl;


sorry for my dirty writing,i dont know why the code doesnt paste good here

[edit]Code blocks tidied up - OriginalGriff[/edit]
Posted
Updated 14-Apr-11 21:24pm
v7
Comments
OriginalGriff 15-Apr-11 3:26am    
When you say "it doesn't work" do you have any further information? An error message perhaps? Or a "it outputs '6' and I expected '9'"?
Try to help us to help you!

You should make a loop to output all the vector items.
BTW my_vector is a vector of what? What is 'unum'?
 
Share this answer
 
Comments
arashmobileboy 15-Apr-11 4:06am    
my_vector is a vector that shows the vector that GetCloseTeammateToTeammate give.and it defined like this:
const std::vector<unum> & GetCloseTeammateToTeammate(Unum i)
CPallini 15-Apr-11 4:44am    
That's not the (exact) definition of my_vector. Please update your original question reporting the definition of the types you've to deal with.
If there is no output at all, the result class that you put into the vector is missing the definition of the << operator.

Using C++ operator overloading to make a simple fraction class[^]

http://www.fredosaurus.com/notes-cpp/oop-friends/overload-io.html[^]

Good luck!
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900