fork download
  1. #include <vector>
  2. #include <iostream>
  3. using namespace std;
  4.  
  5. int main() {
  6. vector<int> data{1, 2, 3, 4, 5, 6, 7};
  7. for (auto elem : data) {
  8. data.push_back(elem * 2);
  9. data.push_back(elem * 3);
  10. }
  11.  
  12. for (int x : data) { cout << x << " "; }
  13. cout << "\n";
  14. }
Success #stdin #stdout 0s 15240KB
stdin
Standard input is empty
stdout
1 2 3 4 5 6 7 2 3 0 0 6 9 8 12 10 15 12 18 14 21