fork(1) download
  1. #include <vector>
  2. #include <iostream>
  3. using namespace std;
  4. int main() {
  5. vector<int> v{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
  6. for (auto &i : v) {
  7. cout << i << " ";
  8. }
  9. cout << '\n';
  10. for (int k = 0; k <= 10; k++) {
  11. for (int i = 0; i < v.size(); i++) {
  12. if (v[i] == k) {
  13. v.erase(v.begin() + i);
  14. break;
  15. }
  16. }
  17. }
  18. for (auto &i : v) {
  19. cout << i << " ";
  20. }
  21. cout << '\n';
  22. }
Success #stdin #stdout 0s 3456KB
stdin
Standard input is empty
stdout
0 1 2 3 4 5 6 7 8 9