Question: Open a new Visual Studio project. Open a new C++ source file. Write a short program to allocate an array dynamically, enter values into the
Open a new Visual Studio project. Open a new C++ source file. Write a short program to allocate an array dynamically, enter values into the array, and print out the array contents. Code to get you started is shown below. Fill in the blanks below before starting to type in the program. Use an array size between 5 and 10 elements. You are free to make up the exact input.
Sample Code: Fill in blanks, add code as needed, etc.
#include ___________________
using namespace std;
void main ( )
{
int listsize; // Storage for input size of the list
double *list; // Pointer to dynamically allocated array.
// Get the size of the array.
cout << Enter the array size: ;
cin >> _______________
// Allocate an array of the specified size.
____________________________________________________
// Read in the array elements.
cout << Enter the array elements: ;
for (int j=0; j < listsize; j++ )
cin >> _______________________;
// Output the array elements.
cout << The array contains: ;
for (int j=0; j < listsize; j++ )
cout >> _______________________;
// Deallocate the memory used to store the string.
__________________________________
please!!! thank you.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
