The problem I'm dealing with is below(I have no clue where to start or what to do i need an educational answer)
Add a function named remove that accepts an integer array of numbers, the array size and an integer value. The remove function must remove the first occurrence of the passed integer value, if found, and shift each of the following elements to the left and add a zero at the end of the array
I am working on a mac Xcode, my code is as follows. If possible I am hoping for an explanation of what I am to do and how to do it I'm a visual person so please have an example
#include <iostream>
using namespace std;
bool search(int arr[], int size, int val);
const int SIZE = 25;
int main()
{
int nums[SIZE]; // array declaration
bool found;
int N;
// display the content of the array nums
cout<<"\n*****************************************************************";
cout<<endl;
for (int i=0; i<SIZE; i++) {
cout<< nums[i] << "\t";
}
cout<<"\n*****************************************************************";
cout<< endl;
cout<<"Please Enter a number BETWEEN o to 250 "<< endl;
cin>> N;
found=search(nums,SIZE,N);
if (found==true) {
cout<< N << " was found in our data set!\n";
} else {
cout<< N << " was NOT found in our data set!\n";
}
for (int i = 0; i<SIZE; i++)
{
if (nums[i] ==N)
{
cout<<" nums[ " << i << " ] " << " Is where " << N << " Is located"<< endl;
}
}
return 0;
}
bool search(int nums[], int SIZE, int N)
{
for (int i = 0; i<SIZE; i++)
{
if (nums[i] ==N)
{
return true;
}
}
return false;
}