#include #include #include using namespace std; void splitArray(const vector& arr) { vector odd, even; // Separate even and odd numbers for (int num : arr) { if (num % 2 == 0) even.push_back(num); else odd.push_back(num); } // Sort both arrays sort(odd.begin(), odd.end()); sort(even.begin(), even.end()); // Print odd numbers for (int num : odd) cout << num; cout << endl; // Print even numbers for (int num : even) cout << num; cout << endl; } int main() { vector arr = {9, 8, 7, 6, 5, 4, 3, 2, 1}; splitArray(arr); return 0; }