fork download
  1. #include <iostream>
  2. #include <vector>
  3.  
  4. int main() {
  5. std::vector<int> v;
  6. v.reserve(10);
  7. for (int i = 0; i < 10; ++i)
  8. {
  9. v[i] = i * 2;
  10. }
  11.  
  12. for (int i = 0; i < 10; ++i)
  13. {
  14. std::cout << v[i] << " ";
  15. }
  16. std::cout << std::endl;
  17.  
  18. return 0;
  19. }
Success #stdin #stdout 0s 3468KB
stdin
Standard input is empty
stdout
0 2 4 6 8 10 12 14 16 18