Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ Practice Problem Help 7. Given the following, write the code to have C++ calculate: long Arr [100]; a. Using the array name, Arr, calculate

C++ Practice Problem Help

7. Given the following, write the code to have C++ calculate:

long Arr [100];

a. Using the array name, Arr, calculate NUMBER OF BYTES IN ONE ELEMENT:

b. Calculate the NUMBER OF BYTES IN ONE ELEMENT using the data type

(problematic for future code maintenance).

c. Calculate the total number of bytes in the entire array.

d. Calculate the number of elements in the array.

Anything relating to reference variables or arrays will be so described. Assume any others are by value

8. Write the header line for the following functions - each function is named F1

A function returning a long and receiving as data parameters a short, an array of float and an array of double.

b. A function returning a reference to an int and receiving a 2 dimensional array of double with 23 columns.

c. Returning an int and receiving 3 int reference variables.

9. Write the following functions in full, including header line and body. Call each F1.

a. Receives 4 arguments, two arrays of short and two int's, one for each array, containing the count of array elements in that array. The function computes one grand total for both arrays. It then returns the grand total.

b. Receives an array of long. Returns the 2nd value stored in the array.

c. Write a function to receive a 2 dimensional array of long double with 10 columns. Also you will receive a short value representing the number of rows. The function totals all of the amounts in the array. The total of the values is returned as a long double.

d. . This function, F1, receives a pointer to an int array and a pointer to a double as arguments. It then calls the function called F2, which has the following prototype:

void F2( int *arr, double num );

F1 is going to call F2 and send the array and the double value as arguments, receiving nothing back.

Write the entire function F1 which calls F2 as its only operation.

e. Change this function to reference variables:

int * fun1( float *a, int *b, float d)

{

*a = *b * d;

return a;

}

Rewrite the entire function below:

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Students also viewed these Databases questions