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...
icon
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
steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
Array
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.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Programming with Microsoft Visual Basic 2017
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:
9781337102124
Author:
Diane Zak
Publisher:
Cengage Learning