Ask the user how many numbers he/she will enter Make a dynamic array to store the numbers Populate the array with the user's input (stop taking input if the user enters a non- numeric input or if the array is full) • If there is some "empty" space in the array at the end (i.e. if the user did not enter enough numbers to fill the array), then: o Copy the values into a new dynamic array that is exactly the right size (so that no memory wasted). Do this using pointer notation (i.e. using array- pointer duality, no square brackets). o Deallocate the memory used for the old array
Ask the user how many numbers he/she will enter Make a dynamic array to store the numbers Populate the array with the user's input (stop taking input if the user enters a non- numeric input or if the array is full) • If there is some "empty" space in the array at the end (i.e. if the user did not enter enough numbers to fill the array), then: o Copy the values into a new dynamic array that is exactly the right size (so that no memory wasted). Do this using pointer notation (i.e. using array- pointer duality, no square brackets). o Deallocate the memory used for the old array
C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter7: Arrays
Section7.3: Declaring And Processing Two-dimensional Arrays
Problem 7E: (Electrical eng.) a. An engineer has constructed a two-dimensional array of real numbers with three...
Related questions
Question
Write
•
•
•
a piece of code that does the following:
Ask the user how many numbers he/she will enter
Make a dynamic array to store the numbers
Populate the array with the user's input (stop taking input if the user enters a non-
numeric input or if the array is full)
• If there is some "empty" space in the array at the end (i.e. if the user did not enter
enough numbers to fill the array), then:
o Copy the values into a new dynamic array that is exactly the right size (so
that no memory wasted). Do this using pointer notation (i.e. using array-
pointer duality, no square brackets).
o Deallocate the memory used for the old array
Expert Solution
![](/static/compass_v2/shared-icons/check-mark.png)
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 2 steps with 1 images
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you
![C++ for Engineers and Scientists](https://www.bartleby.com/isbn_cover_images/9781133187844/9781133187844_smallCoverImage.gif)
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
![C++ Programming: From Problem Analysis to Program…](https://www.bartleby.com/isbn_cover_images/9781337102087/9781337102087_smallCoverImage.gif)
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
![C++ for Engineers and Scientists](https://www.bartleby.com/isbn_cover_images/9781133187844/9781133187844_smallCoverImage.gif)
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
![C++ Programming: From Problem Analysis to Program…](https://www.bartleby.com/isbn_cover_images/9781337102087/9781337102087_smallCoverImage.gif)
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
![EBK JAVA PROGRAMMING](https://www.bartleby.com/isbn_cover_images/9781337671385/9781337671385_smallCoverImage.jpg)
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
![Programming with Microsoft Visual Basic 2017](https://www.bartleby.com/isbn_cover_images/9781337102124/9781337102124_smallCoverImage.gif)
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:
9781337102124
Author:
Diane Zak
Publisher:
Cengage Learning