

A vector contains both positive and negative numbers in random order. Write a function to rearrange the vector elements so that all negative numbers appear before all positive numbers. You must use two pointer approach to solve this problem and use pass-by-reference to your function. Input: nums ={?12,11,?13,?5,6,?7,5,?3,11} Output: nums ={?12,?3,?13,?5,?7,6,5,11,11} Step 1. Create a new project called Lab 7. Step 2. Create a source.cpp, myFunction.cpp, myFunction.h files. Step 3. Inside the myFunction.cpp file write a function to rearrange the vector elements so that all negative numbers appear before all positive numbers void moveNegativeElements (vector < int >& nums) \{ // add your code \} void moveNegativeElements (vector < int >& nums) \{ I/ add your code \} Step 4. Call the function from your main program and test your function using the following examples. int main() \{ vector < int > nums ={?12,11,?13,?5,6,?7,5,?3,11}; cout << "Initial nums ="; for (int i;ums) cout <i<"<; cout << endi; moveNegativeElements(nums); cout << "After reversing nums ="; for (int i nums) cout <i<<";; cout << endi; return ?; \} int main(){ vector nums ={?12,11,?13,?5,6,?7,5,?3,11} cout < "Initial nums ="; for (int i :nums) cout <i<" " cout < endl; moveNegativeElements(nums); cout < "After reversing nums = "; for (int i :nums) cout <i?" "; cout < endl; return ?; \}
Step 6. Add the following unit tests to your test file. The expected results may vary depending on your code implementation. You can do manual test on the following inputs and figure out the expected results and set up the unit tests. Test1 :num1 ={4,?2,9,?5,0,?8,3,?1} Test2 : num1 ={1,2,3,4,5} Test3 : num1 ={?1,?2,?3,?4,?5}?