You are on page 1of 1

hw6

Send your solutions to: halomari@fbsu.edu.sa


Write a program that sorts and merge two vectors on integers.

#include <iostream>
#include <vector>
#include <algorithms>

vector<int> v1{10, 90, 20, 80, 30, 70, 40, 60, 50};
vector<int> v2 = {15, 55, 35, 45, 25};
vector<int> v;

Use sort(v.begin(), v.end()) or std::sort().

1. Write a function void display_int_array(int a[], int length);


that displays the elements of a.

1. Sort v1 in an ascending order


2. Display v1.
3. Sort v2 in an ascending order
4. Display v2.
3. Write a loop that merges v1 and v2 in v sorted in an ascending order.
4. Display v.

You might also like