It prints out in the order you build the vector. If that's not the order you want to print them, then either (a) build the vector in the opposite order (b) use reverse to reverse the vector (c) pick a container that supports push_front instead.