Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a C++ program that prompts the user for two integer arrays and their size. If the size entered by the user is less than

image text in transcribedimage text in transcribed

Write a C++ program that prompts the user for two integer arrays and their size. If the size entered by the user is less than or equal to zero, ask the user to input again. Then, the program should have three functions described below: dotProduct(...arguments here...): This function has the 2 integer arrays and their size as arguments (for a total of 3 arguments). Compute and return the dot product of these 2 arrays. You must print the dot product from your mainO function. The dot product can be found by adding the products of each element of the arrays. Do NOT use array brackets when accessing the element values of your arrays in this function (use pointers instead) + Ex. Array 1: [1,2,3,4] and Array 2: [3,3,4,6] + Dot Product= ((13) + (2"3)+ (3 4)+ (4#6): 45 - alternate(...arguments here...): This function also takes 2 integer arrays and their size as arguments (for a total of 3 arguments). Print the elements of both of these arrays by alternating the elements of each array. Use array brackets to access the elements for this function. + Ex. Array 1: [1,2,3,4] and Array 2: [5,6,7,8] + It should print: [1,5,2,6,3,7,4,8] - negatives(...arguments here...): This function takes in 2 integer arrays and their size as arguments (for a total of 3 arguments). Change the value of each array to its additive inverse (its negative). You may choose the way you want to access the + A number, N', is the additive inverse of a number, N, if it satisfies the property: N + N, = o + Ex. Array 1: [-1,2,3,-4] + Your program should change the array values with new values: [1,-2,-3,4] These functions must be called from your mainO function

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Students also viewed these Databases questions

Question

Presentations Approaches to Conveying Information

Answered: 1 week ago