Question: Language is C++ 1. Vector Operations We are going to write a program to perform arithmetic on vectors, specifically to add and subtract them. We

 Language is C++ 1. Vector Operations We are going to write

Language is C++

1. Vector Operations We are going to write a program to perform arithmetic on vectors, specifically to add and subtract them. We will store a vector using an integer array. Function Description You have to write the following functions. print_vector. prints the contents of the vector passed to it. input_vector. populates the vector passed to it with values input form the console. add_vectors takes 3 vectors as parameters and stores the sum of the first 2 vectors in the third one subtract_vectors takes 3 vectors as parameters and stores the difference of the first 2 vectors in the third one compare_vectors. takes 2 vectors as parameters and returns true if they are equal and false otherwise. You may pass any additional parameters to your functions as needed. Input Format For Custom Testing The first line contains an integer, n, denoting the dimension of the 2 vectors that follow. The next line contains n space separated integers which represent the first vector. The next line contains n space separated integers which represent the second vector. The next line contains a single character which is one of: + -- Depending on the character, you have to output the sum or the difference of the vectors or if the vectors are equal

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!