cout << "Enter size of array: " << endl;
cin >> size;
cout << "Enter elements: ";
for(i=0;i<size;i++)
{
     cin >> array[i]; 
}

Recommended Answers

problem display the unchange array

i don't see the code for displaying an array. you should use cout<< for displaying
i don't know what do you mean by the word unchange.

you should declare a pointer variable because i think you wanna play with dynamic array.so try …

Jump to Post

All 2 Replies

what's the problem? How is array declared?

problem display the unchange array

i don't see the code for displaying an array. you should use cout<< for displaying
i don't know what do you mean by the word unchange.

you should declare a pointer variable because i think you wanna play with dynamic array.so try this:

int* array;
cout<<"enter size";
cin>>size;
array=new int[size];

here is code for getting input:

for(i=0;i<size;i++)
{
    cin>>array[i];
}

and for displaying an array:

for(i=0;i<size;i++)
{
    cout<<array[i];
}

instead of code, you provide nothing.
please explain your question.

commented: right +14
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.