Your program creates a dynamically allocated array as follow

Your program creates a dynamically allocated array as follows:
int *entry;
entry = new int[10];
so that the pointer variable entry is pointing to the dynamically allocated array. Write code to fill this array with 10 numbers typed in at the keyboard.

Solution


#include <iostream>

using namespace std;

int main()

{

int * entry;

entry = new int [10];

int array_size = 10;

int num;

for(int i = 0; i< array_size; i++)

entry[i] = i;

for(int i = 0; i < array_size; i++)

{

cout << \"Enter an int into the array: \" << endl;

cin << entry[i] << endl;

}

return 0;

}

Your program creates a dynamically allocated array as follows: int *entry; entry = new int[10]; so that the pointer variable entry is pointing to the dynamicall

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site