Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The last 2 pictures are for the the first part A Part A Name the file lab2dynamic.cpp Write a new version of the program in

The last 2 pictures are for the the first part A image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
Part A Name the file lab2dynamic.cpp Write a new version of the program in Lab 2 using pointers. main function will create the ar of radi and pass it to the function calcArea. calcArea will dynamically create a new array to store areas of circles and return a pointer to the new array to main function. main will then pass the pointers of the two arrays to printArrays to display both. Coding details: 1. main function: Declare an array of 10 ints called radi and initialize it with values multiples of 2. Define a pointer of type double to store the returned pointer. Call the function calcArea passing a pointer to radii array and the size. The returned pointer will be stored in the double pointer you defined. - - Call the function printArrays. 2. Function calcArea: accepts as it's arguments a pointer to the array radi and the size. The function will return a pointer of type double. The prototype of the function: double calcArea(int* Coded as follows: , int -Dynamically allocate an array of "doubles" using the received size. - Calculate the areas of the circles using radii array and store them in the created array. Return the pointer of the new array to main function. 3. Function printArrays will accept the pointers of the radi and areas array and prints their values

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_2

Step: 3

blur-text-image_3

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

Big Data And Hadoop Fundamentals Tools And Techniques For Data Driven Success

Authors: Mayank Bhushan

2nd Edition

9355516665, 978-9355516664

More Books

Students also viewed these Databases questions

Question

1. What are the pros and cons of five sources of job candidates?

Answered: 1 week ago

Question

a. Describe the encounter. What made it intercultural?

Answered: 1 week ago