how to print vector in c++ by stl code example Example: cpp print vector for(int i = 0; i < vec.size(); i++) std::cout << vec[i] << ' ';