Question: i have made a function in c++ to insert a number into a postion in an array but i keep lossing the last number in
i have made a function in c++ to insert a number into a postion in an array but i keep lossing the last number in the array. i tried to update the size of the array but that doesnt seem to work. if you could help me make the array one bigger from yhe original and keep the last number in the array.
(ex)
void insert(double array[], int size) { int pos, num; cout > num; cout > pos; array[size] = array[size+1]; for (int i = size+1; i >= pos; i--) { array[i] = array[i-1]; } array[pos] = num; }
output

smb-is1e1 citrix thh17\Documents Visual Studio 20131Projectslarray.cpplarray.cpp CMD. EXE was started with the above path as the current directory UNC paths are not supported. Defaulting to Windows directory. Enter the number of elements you want to enter (Max 1e0): 5 Enter 5 numbers: 1 6 Enter the number: 2 Enter the Position: 1 4 Press any key to continue . . . _
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
