Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

Students also viewed these Databases questions

Question

1. Write down two or three of your greatest strengths.

Answered: 1 week ago

Question

What roles have these individuals played in your life?

Answered: 1 week ago

Question

2. Write two or three of your greatest weaknesses.

Answered: 1 week ago