Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

For your lab implement the following First ask a number of elements for the size of the array (this means your array is dynamic) The

image text in transcribed

For your lab implement the following First ask a number of elements for the size of the array (this means your array is dynamic) The next step will be initialize all the places in the array to 0 Finally, create an infinite loop that will do: Ask the user for a number greater than 0 o Place the number in the correspondent location in the array based on the % key O Display the current array of the user enters-1, get out of the loop and return to ask the user how many numbers the array should have. Make sure you free the memory for the previous array you created. You don't want to have a memory leak. o Get out of the loop and close the program when the user enters -2 GUIDELINES . Code All in Functions! Asking for a value, finding the key, assigning the value to the correspondent key, and printing the array should be all separate functions Dynamic Memory o This lab is about Dynamic Memory. You cannot use a static array. Make sure your array is dynamically created using pointers Memory requests should use new and memory clearing should be done with free (Page 6 in Lecture Notes #4) Comments o Make sure that your code is documented document your logic, explain what you are doing Also that it has your name at the top of the file as mentioned in the notes o Provide some empty lines to separate your code Naming your File: o Your file should be name as this example: ajerez weekBlab2.cpp

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

Recommended Textbook for

The Database Management Systems

Authors: Patricia Ward, George A Dafoulas

1st Edition

1844804526, 978-1844804528

More Books

Students also viewed these Databases questions

Question

Explain in detail how the Mughal Empire was established in India

Answered: 1 week ago

Question

Problem: Evaluate the integral: I - -[ze dx

Answered: 1 week ago

Question

Problem: Evaluate the integral: I = 1- 1 dx 9

Answered: 1 week ago