Question: Write a C++ program that includes the following: Declare functions initial_vector_input, print_vector, and merge_vector in the header file funcs.h. // initialize the vector with user
Write a C++ program that includes the following:
Declare functions initial_vector_input, print_vector, and merge_vector in the header file funcs.h.
// initialize the vector with user input values, stop the input when user enters -1 void initial_vector_input(vector& v); // print the vector void print_vector(const vector & v); // merge two vectors, alternating elements from both vectors. // if one vector is shorter than the other, then alternate as // long as you can and then append the remaining elements from // from the longer vector. vector merge_vector(const vector & v1, const vector & v2);
Impletment three functions in the file funcs.cpp.
The main function is contained in the file lab07.cpp. The main function,
Creates two empty vectors.
Prompts the user to enter values to initialize two vectors, respectively.
Prints two vectors.
Merges two vectors.
Prints the new vector.
The expected result:
Initialize the first vector: 1 3 5 7 -1 Initialize the second vector: 2 4 6 8 10 12 -1 The first vector is: 1 3 5 7 The second vector is: 2 4 6 8 10 12 The new vector is: 1 2 3 4 5 6 7 8 10 12
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
