fork download
  1. #include <iostream>
  2. #include <vector>
  3.  
  4. using namespace std;
  5.  
  6. template<typename T>
  7. void show(vector<T> const& x) {
  8. for (typename vector<T>::const_iterator it = x.begin(); it != x.end(); ) {
  9. for (size_t i = 0; (i != 8) && (it != x.end()); ++i, ++it) {
  10. cout << *it << ' ';
  11. }
  12. cout << endl;
  13. }
  14. }
  15.  
  16.  
  17. int main() {
  18. vector<int> x = {1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 13243};
  19. show(x);
  20. cout << "!" << endl;
  21. }
  22.  
Success #stdin #stdout 0s 3428KB
stdin
Standard input is empty
stdout
1 2 3 4 5 6 7 8 
9 0 13243 
!