Write the c statement that dynamically creates an array of


Question 1:  Consider the subsequent statement:

int *num;

Program 1) Write the C++ statement that dynamically creates an array of 10 components of type int and num contains the base address of the array

Program 2) Write the C++ code that inputs data into the array num from the standard input device

Program 3) Write the C++ statement that de-allocates the memory space of array to which num points

Question 2: Write the copy-array procedure by a function

int main()

{

int *a, *b;

int lena, lenb;

cout << "Enter the length of a: ";

cin >> lena;

a = new int[lena];

// Assume some values are loaded in a.

b = CopyArray(a, lena, lenb); // WRITE THIS FUNCTION!!

// After the function, 'b' is a copy of 'a' and

// 'blen' represents the length of 'b'

}

===================================================

Question 3:

Write the function: void shuffle(int ar[], int size);

This function "shuffles" the elements in the array pointed by 'ar' (and whose length is 'size'). To do so, you randomly choose TWO indices (NOT ONE) and swap the elements.

Can you write these programs in C++ language? Define every function.

Request for Solution File

Ask an Expert for Answer!!
C/C++ Programming: Write the c statement that dynamically creates an array of
Reference No:- TGS0946509

Expected delivery within 24 Hours