#include <iostream>
#include <utility>
#include <vector>
using namespace std;
int main()
{
vector< pair<int, int> > v;
int N = 5;
const int threshold = 2;
for(int i = 0; i < N; ++i)
v.push_back(make_pair(i, i));
int i = 0;
while(i < v.size())
if (v[i].second > threshold)
v.erase(v.begin() + i);
else
i++;
for(int i = 0; i < v.size(); ++i)
cout << "(" << v[i].first << ", " << v[i].second << ")
";
cout << "Done" << endl;
}
Code Example |
---|
Cpp :: dynamic memory c++ |
Cpp :: c function as paramter |
Cpp :: c++ thread |
Cpp :: list in c++ |
Cpp :: define in cpp |
Cpp :: vector library c++ |
Cpp :: print stack without pop c++ |
Cpp :: c++ convert const char* to int |
Cpp :: SUMOFPROD2 solution |
Cpp :: find a number in vector c++ |
Cpp :: c++ get whole line |
Cpp :: c++ random number |
Cpp :: toupper c++ |
Cpp :: grep xargs sed |
Cpp :: run c++ program mac |
Cpp :: data types in c++ |
Cpp :: il2cpp stuck unity |
Cpp :: how creat matrix column in c++ |
Cpp :: get std string from file |
Cpp :: c++ open webpage |
Cpp :: What is a ~ in c++ |
Cpp :: C++ Arrays and Loops |
Cpp :: stoi in c++ |
Cpp :: how to declare an enum variable c++ |
Cpp :: int cpp |
Cpp :: C++ Nested if |
Cpp :: right shift in c++ |
Cpp :: definition of singly linkedlist |
Cpp :: Maximum element in a map c++ |
Cpp :: quicksort algorithm |