for loop Not outputting code

Pages: 123
closed account (Dy7SLyTq)
1
2
for(auto i : v_business)
     cout<< i << endl;
How do i output the vector though, i thought thats waht i was doing in the very last for loop?


As I said in a previous post:

*str_it is a Business - i.e. a struct. You can't just "print out a struct" - that's meaningless. You need to print the elements of the struct that you want to print.


You already know how to access the members of a struct - you access the members of B at several points in your code. You need to do the same for the structs in your vector, which you get by deferencing the iterator.
Topic archived. No new replies allowed.
Pages: 123