#include #include #include using namespace std; void splitAndSort(vector arr) { vector odd, even; for (int num : arr) { if (num % 2 == 0) even.push_back(num); else odd.push_back(num); } sort(odd.begin(), odd.end()); sort(even.begin(), even.end()); // Printing output for (int num : odd) cout << num << " "; cout << endl; for (int num : even) cout << num << " "; cout << endl; } int main() { vector arr = {9, 8, 7, 6, 5, 4, 3, 2, 1}; splitAndSort(arr); return 0; }