Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <vector>
- #include <iostream>
- using namespace std;
- void odd_even(vector<int> &a,const int &lenght) {
- int left = 0;
- for (int i = 0; i < lenght; i++)
- {
- if (a[i] % 2 == 0)
- {
- swap(a[i], a[left]);
- left++;
- }
- }
- }
- int main()
- {
- vector<int> array = { 6, 9,66,785,632,569,56,654,2,0, 31,23,33};
- odd_even(array, array.size());
- for(int i=0;i<array.size();i++)
- cout<<array[i]<< " ";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement