vector<int> myVector = { 1, 3, 10, 20, 13, 15, 4, 7, 9 , 18, 19, 1, 3 };
for (int i = 0; i < myVector.size(); i++) {
if (myVector[i] > 9) {
myVector.erase(...........) // как тут прописать?
}
}
#include<iostream>
#include<vector>
using namespace std;
int main()
{
vector<short> myVector = { 1, 3, 10, 20, 13, 15, 4, 7, 9 , 18, 19, 1, 3 };
for (auto b = myVector.begin(); b!=myVector.end();)
{
if ((*b) > 9)
{
b = myVector.erase(b);
}
else b++;
}
for (const auto s : myVector)
{
cout << s << " ";
}
return 0;
}