need help in making a program

Consider a,b,c as three arrays of size m,n,m+n respectively.array a is stored in ascending order whereas array b is stored in descending order.write a c++ program to produce a third array c, containing all the data of arrays a and b arranged in descending order.Display the data of array c only.
I need a more specific answer
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
std::vector<int> a = {2, 3, 4,5, 1 };
std::vector<int> b = { 3, 5, 1, 2, 9 };
std::vector<int> c;

std::sort(a.begin(), a.end());
std::sort(b.begin(), b.end(), std::greater<int>());
	
c.reserve(a.size() + b.size());
c.insert(c.end(), a.begin(), a.end());
c.insert(c.end(), b.begin(), b.end());
	
std::sort(c.begin(), c.end(), std::greater<int>());

for (unsigned int i = c.size(); i-- > 0;){
	std::cout << c.at(c.size() - i - 1);
}
Got detaied answer? If yes pls post it here...
Topic archived. No new replies allowed.