View Single Post
Join Date: Oct 2007
Posts: 305
Reputation: stilllearning has a spectacular aura about stilllearning has a spectacular aura about 
Solved Threads: 43
stilllearning stilllearning is offline Offline
Posting Whiz

Re: Need help removing number from an array

 
0
  #2
Oct 21st, 2008
You aren't assigning the variable index a value before calling the functions removeAt and insertAt. So you need to fix that first.

Well I just noticed that you are asking for the index in your function, in which case why are you passing "index" to it ? You really shouldn't be passing in arguments which have no valid values.

Now in your removeAt function you do this

for (int i = 0; i < length; i++)
   {
     numbers[i] = numbers[i+1];
     cout<<numbers[i]<<" ";
   }

You are shifting all the values starting from position 0, you only need to shift them starting at position index.
Last edited by stilllearning; Oct 21st, 2008 at 1:51 am.
Reply With Quote