Question: bool NumberList::insert ( double number, int position ) { if ( position < 0 | | position > = length | | length > =

bool NumberList::insert(double number, int position)
{
if (position <0|| position >= length || length >= MAX_CAPACITY){
cout << "THE NUMBERLIST IS FILLED TO CAPACITY" << endl;
return false;
}
for (int i = length; i >= position; i--){
numbers[i]= numbers[i];
}
numbers[position]= number;
length++;
return true;
}
Can I get help fixing this error. When I put a position it goes into the spot after I request. Example: I input position 5 but it goes in position 6

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!