Question #37365
Write code that dynamically allocates an array of 20 integers, then uses a loop to allow the user to enter values for each element of the array
1
Expert's answer
2017-03-27T11:20:14-0400
#include <iostream> #include <conio.h>using namespace std;int main () {          int* array = new int [20];          for (int i=0; i<20; i++)          {                     cout<<"Enter the "<<i+1<<" elemet of the array: ";                     cin>>array[i];          }      cout<<"So, this is the array :"<<endl;          for (int i=0; i<20; i++)         {                     cout<<array[i]<<" ";         }             delete [] array;    _getch();        return 0;}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!
LATEST TUTORIALS
APPROVED BY CLIENTS