SHARE
TWEET

Untitled

a guest Feb 22nd, 2019 51 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. #include <vector>
  3. #include <algorithm>
  4.  
  5. using namespace std;
  6.  
  7. int main()
  8. {
  9.     vector<int> vectorNumber = {1, 1, 3, 1, 1, 3, 2, 2, 1};
  10.  
  11.     // Poistetaan vectorista ykk√∂set
  12.     vectorNumber.erase(
  13.                       remove_if(vectorNumber.begin(), vectorNumber.end(),
  14.                                 [] (const int i) { return (i == 1);} ),
  15.                       vectorNumber.end()
  16.                       );
  17.  
  18.     // Poistetaan vectorista kolmoset
  19.     vectorNumber.erase(
  20.                       remove(vectorNumber.begin(), vectorNumber.end(), 3),
  21.                       vectorNumber.end()
  22.                       );
  23.  
  24.     for (int i : vectorNumber)
  25.     {
  26.         cout << i << endl;
  27.     }
  28.  
  29.     return 0;
  30. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top