Question: Deliverable 1: Write a program that contains a main function as well as a function named avgThree. The function avgThree averages three values. Its declaration

Deliverable 1:

Write a program that contains a main function as well as a function named avgThree. The function avgThree averages three values. Its declaration is: double avgThree(double *xptr, double *yptr, double *zptr); Notice that the three arguments are all pointers to doubles. Test out this function inside your main function.

Deliverable 2:

Modify the code above so that it uses an array of doubles instead of integers. What is the spacing between addresses of elements? Repeat for characters instead. (You don't need to turn in your code for this deliverable. Instead, tell me the address spacings.) Hint for the char case: Modify the code above so that it uses an array of doubles instead of integers. What is the spacing between addresses of elements? Repeat for characters instead. (You don't need to turn in your code for this deliverable. Instead, tell me the address spacings.) Hint for the char case: cout<(&myArray[0])<

int myArray[4]={1,1,2,2};

int (*aptr)[4];

aptr=&myArray;

cout<<"The contents of the first element is:"<<(*aptr)[0]<

cout<<"The address of myArray is:"<<&myArray<

cout<<"The same value is stored in aptr"<

cout<<"myArray[0] has the same address:"<<&myArray[0]<

cout<<"myArray[1] has address:"<<&myArray[1]<

cout<<"myArray[2] has address:"<<&myArray[1]<

cout<<"myArray[3] has address:"<<&myArray[1]<

Deliverable 3:

Write a program that asks the user for an integer. Your program should display that many (uniform) random integers between 0 and 100. Your program should also tell the user how many of the numbers were greater than 75. You can use either C style or C++ style instructions for generating random numbers, but be sure to seed your random number generator.

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!