fork download
  1. #include <iostream>
  2. #include <vector>
  3.  
  4. int main()
  5. {
  6. std::vector<int> v1 = {10, 20, 30, 40};
  7. for ( auto el : v1 )
  8. {
  9. std::cout << el << std::endl;
  10. }
  11.  
  12. std::vector<std::vector<int>> v2 = {{10, 20, 30}, {40, 50, 60}};
  13. for ( auto const& row : v2 )
  14. {
  15. for ( auto el : row )
  16. {
  17. std::cout << el << " ";
  18. }
  19. std::cout << std::endl;
  20. }
  21. }
  22.  
Success #stdin #stdout 0s 15240KB
stdin
Standard input is empty
stdout
10
20
30
40
10 20 30 
40 50 60