Write a menu-driven program that will allow the user to run any of the following questions. Please put the functions headers in .h file and the functions definitions in a SRR file. 1. Write C++ code for a loop that simultaneously computes both the maximum and minimum element in a given vector. 2. Write a function double scalar_product(vector a, vector b) that computes the scalar product of two vectors. The scalar product of two vectors A(al, a2, a3) and B(b1, b2, b3} is another vector C given by C{c1, c2, c3) where cl = al b1, c2a2b2, c3 = a3 + b3. 3. Write a function that computes the alternating sum of all elements in a vector. For example, if alternatingSum() is called with a vector containing 149 16 9 7 4 9 11 then it computes 1-4+9-16+9-7+4-9+11=-2 4. Write a procedure reverse that reverses the sequence of elements in a vector. For example, if reverse is called with a vector containing 149 16 9 7 4 9 11 then the vector is changed 11 9 4 7 9 16 9 4 1 5. Write a function vector append(vector a, vector b) That appends one vector after another. For example, if a is 149 16 and bis then append returns the vector 9749 11 149 16 9 7 4 9 11 6. Write a function vector merge(vector a, vector b) that merges two arrays, alternating elements from both arrays. If one array is shorter than the other, then alternate as long as you can and then append the remaining elements from the longer array. For example, if vector a is

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
100%

These to two screenshots are ONE SINGLE assignment. If you cannot complete this assignment in full, do not answer this question.

If, however, you do plan on building a program using C++ based on the instructions from these two screenshots, then please continue. Thank you for your understanding. 

When you are done, join all your programs together and present the user with a menu so they can select which one they want to run. 

and bis
then merge returns the array
and bis
149 16
9 7 4 9 11
1947 94 16 9 11
7. Write a function
vector<int> merge(vector<int> a, vector<int> b)
that merges two arrays, alternating elements from both arrays. If one array is shorter than
the other, then alternate as long as you can and then append the remaining elements
from the longer array. For example, if ais
149 16
then merge_sorted returns the vector
then the vector is changed to
479911
14 4 7 9 9 9 11 16
8. Write a function that removes duplicates from a vector. For example, if
remove_duplicates is called with a vector containing
149 16 9 7 4 9 11
149 16 7 11
9. Design a class Student or use one from a previous exercise. A student has a name and a
birthday. Make a vector
vector<Student> friends;
Read a set of names and birthdays in from a file or type them in, thus populating the
friends vector. Then print out all friends whose birthday falls in the current month.
2
A
G
Transcribed Image Text:and bis then merge returns the array and bis 149 16 9 7 4 9 11 1947 94 16 9 11 7. Write a function vector<int> merge(vector<int> a, vector<int> b) that merges two arrays, alternating elements from both arrays. If one array is shorter than the other, then alternate as long as you can and then append the remaining elements from the longer array. For example, if ais 149 16 then merge_sorted returns the vector then the vector is changed to 479911 14 4 7 9 9 9 11 16 8. Write a function that removes duplicates from a vector. For example, if remove_duplicates is called with a vector containing 149 16 9 7 4 9 11 149 16 7 11 9. Design a class Student or use one from a previous exercise. A student has a name and a birthday. Make a vector vector<Student> friends; Read a set of names and birthdays in from a file or type them in, thus populating the friends vector. Then print out all friends whose birthday falls in the current month. 2 A G
ASSIGNMENT: WORKING WITH VECTORS
Write a menu-driven program that will allow the user to run any of the following
questions. Please put the functions headers in .h file and the functions definitions in a
-SPR file.
1. Write C++ code for a loop that simultaneously computes both the maximum and minimum
element in a given vector.
2. Write a function
double scalar_product(vector<double> a, vector<double> b)
that computes the scalar product of two vectors. The scalar product of two vectors
A[al, a2, a3) and B (b1, b2, b3} is another vector C given by
C{c1, c2, c3} where c1 = a1 + b1, c2 = a2 + b2, c3 = a3 + b3.
*
3. Write a function that computes the alternating sum of all elements in a vector.
For example, if alternatingSum() is called with a vector containing
149 16 9 7 4 9 11
then it computes
1-4+9-16+9-7+4-9+11=-2
4. Write a procedure reverse that reverses the sequence of elements in a vector. For
example, if reverse is called with a vector containing
149 16 9 7 4 9 11
then the vector is changed
11 9 4 7 9 16 941
5. Write a function
vector<int> append(vector<int> a, vector<int> b)
That appends one vector after another. For example, if a is
149 16
and bis
then append returns the vector
9 7 4 9 11
149 16 9 7 4 9 11
6. Write a function
vector<int> merge(vector<int> a, vector<int> b)
that merges two arrays, alternating elements from both arrays. If one array is shorter than
the other, then alternate as long as you can and then append the remaining elements
from the longer array. For example, if vector a is
1
Transcribed Image Text:ASSIGNMENT: WORKING WITH VECTORS Write a menu-driven program that will allow the user to run any of the following questions. Please put the functions headers in .h file and the functions definitions in a -SPR file. 1. Write C++ code for a loop that simultaneously computes both the maximum and minimum element in a given vector. 2. Write a function double scalar_product(vector<double> a, vector<double> b) that computes the scalar product of two vectors. The scalar product of two vectors A[al, a2, a3) and B (b1, b2, b3} is another vector C given by C{c1, c2, c3} where c1 = a1 + b1, c2 = a2 + b2, c3 = a3 + b3. * 3. Write a function that computes the alternating sum of all elements in a vector. For example, if alternatingSum() is called with a vector containing 149 16 9 7 4 9 11 then it computes 1-4+9-16+9-7+4-9+11=-2 4. Write a procedure reverse that reverses the sequence of elements in a vector. For example, if reverse is called with a vector containing 149 16 9 7 4 9 11 then the vector is changed 11 9 4 7 9 16 941 5. Write a function vector<int> append(vector<int> a, vector<int> b) That appends one vector after another. For example, if a is 149 16 and bis then append returns the vector 9 7 4 9 11 149 16 9 7 4 9 11 6. Write a function vector<int> merge(vector<int> a, vector<int> b) that merges two arrays, alternating elements from both arrays. If one array is shorter than the other, then alternate as long as you can and then append the remaining elements from the longer array. For example, if vector a is 1
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 12 images

Blurred answer
Knowledge Booster
Datatypes
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education