c++ insert element in array

March 22, 2011 at 11:40:51
Specs: Windows XP
hi i am meriiiiiiiiii
i ma the beginer and i want to know how to build such a function to insert an element in an array pls help.......

See More: c++ insert element in array

Report •

#1
March 22, 2011 at 12:37:43
Move all the elements of the array after the new one up one and insert the new element. Alternatively, create a new array, copy the elements over, including the inserted one, and delete the old array.

Report •

#2
March 22, 2011 at 22:22:46
thanks..........but i want to know code

Report •

#3
March 23, 2011 at 00:49:00
Ah - you want me to do your homework for you. No deal.

If you can't do simple coding like this take up a different course - computer programming is not your thing.


Report •

Related Solutions

#4
April 2, 2011 at 22:34:28
i,m also a beginner but i guess i can help u
for(i=n;i>=pos;i++)
{
a[i+1]=a[i];
n++;
}
a[pos]=k;
for(i=0;i<n;i++)
cout<<a[i];

Report •

#5
April 5, 2011 at 11:57:47
hmmmmmmmmmm ! amazing u are also a beginner I also felt. In first for loop i would be dicrimented not incrimented.
thanks 4 replying.

Report •

Ask Question