Question: A) Write C++ code of a function named dot_Product( ) that returns either the product of two numbers x1 and y1 or the dot product

A) Write C++ code of a function named dot_Product( ) that returns either the product of two numbers x1 and y1 or the dot product of a pair of two-dimensional vectors (x1, y1) and (x2, y2) or the dot product of a pair of three-dimensional vectors (x1, y1, z1) and (x2, y2, z2), according to whether the function is passed 2, 4, or 6 parameters. For example, with four arguments (3.0, 8.0, -4. 0, 6.0), the call dot_Product would return (3.0) (-4.0) + (8.0) (6.0) = 36.0.

B]

Write the C++ code of a function that takes as inputs, a number, position, and digit. The function should return a new number with the digit at position 'position' changed to 'digit'. Start counting the digits from the left means left most digit will be at position zero.

For example:

number = 127856, position = 3, digit = 9: the function returns 127956

number = 2431, position = 0, digit = 5: the function returns 5431

You can write helper functions such as countTheTotalDigitsOfNumber or ReturnDigitAtPosition (returns the value of a digit given a position). Think carefully on the number of parameters and return values of each function. cin and cout should only be done in the main function. The rest of functions should exchange values via parameters.

NOTE ; YOU CANNOT USE ANY break, continue or goto statement IN THIS

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!