Kinda stuck on this one.

Hey guys good evening.

Im doing a exercise in which I have to use voids{} to remove certain numbers and add new ones from a list.
The numbers have to be read as an a array.

The numbers are given:

8 - how many lines there are ( for() function)
4 1 9 10 14 ( how many numbers I need to remove, and what are the numbers)
1 5 (how many numbers, what number i need to add after I removed the other numbers)
1
3
4
7
9
10
13
14

The answer is :
Removing
Nr. 3
Nr. 4
Nr. 7
Nr. 13
Adding back
Nr. 3
Nr. 4
Nr. 5
Nr. 7
Nr. 13

I only know know the basic 1 number removal voids that work with arrays.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
void Remove ( int nr, int &n, int A[])
{
   for ( int i = nr; i < n; i++)
   A[i] = A[i+1];
   n--;
}

void Add ( int nr, int x, int &n, int A[])
{
   for ( int i = n; i > nr; i--)
   A[i] = A[i-1];
   A[nr] = x; 
   n++;
}


I know im asking to much, but I don't have a clue how to do this with multiple numbers including this is with arrays which I don't know that much.
Please bear in mind that im no genius, and I won't understand your line stuff.
So try to keep it as basic as you can with the tips and answers


Are your numbers distinct?

If so, then just use a set.

If not, then define your problem more accurately.
This has already been asked and answered here http://www.cplusplus.com/forum/beginner/283441/ [same question, different input].
Topic archived. No new replies allowed.