C++ Functions And Arrays Part 3

I'm need to make a remove function that removes the first occurrence of the passed integer value, if found, and shift each following element to the left and add a zero at the end of the array and then call the remove function from the main function and display the content of the array after the call. This is as far as I've gotten. I really need help on this.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
  #include <iostream> 
using namespace std; 
int search(int arr[], int size, int val); 
int remove (int go[], int s, int v);
const int SIZE =25; 
int main() 
{ 
 int nums[SIZE]; // array declaration 
int found; 
 int n; 
 
 //initialize array nums 
 for (int i = 0; i < SIZE; i++) 
 { 
 nums[i] = rand( ) % 251; 
 } 
 
 // display the content of array nums 
 cout << "\n************************\n"; 
 for (int i = 0; i < SIZE; i++) 
 { 
 cout << nums[i] << "\t"; 
 } 
 cout << "\n************************\n"; 
 cout << "please enter a number between 0 to 250" << endl; 
 cin >> n; 
 found = search(nums, SIZE, n);
found = remove(nums, SIZE, n);
 if (found != -1){

 cout << n << " was found in our data set!\n";
 
 }
 else 
 cout << n << " was NOT found in our data set!\n";
 return 0; 
} 

int search (int arr[], int size, int val)
{
	for (int i = 0; i < SIZE; i++)
	{
		if (arr[i] == val)
			return i;
	}
return -1;
}

int remove (int go[], int s, int v)
{
	for (int i = 0; i < s; i++)
	{
		//purposely not completed
	}

}
Topic archived. No new replies allowed.