hi all , i need help with a c++ program here is the qustion 


Question # 

Write a program that contains a function named "remove_duplicates" that takes an array of integers in random order, and then eliminates all the duplicate integers in the array. The function should take three arguments:
(1) An array of integers which is (read and filled in main)
(2) The size of the array.
(3) A variable passed by reference to be printed in main to show how many values in the array
without duplication.
The function should not return a value, but if any duplicate integers are eliminated, then the function should count that, so the new value tells the number of distinct integers in the array. Suppose the array passed to the function is as shown below, and the size of the array passed to the function is 10.
0 1 2 3 4 5 6 7 8 9
58 | 26 | 91 | 26 | 70 | 70 | 91 | 58 | 58 | 66
The function should change the array to look like this:
0 1 2 3 4 5 6 7 8 9
58 | 26 | 91 | 70 | 66 | ?? | ?? | ?? | ?? | ??

and it should change the value of the distinct counter so that it is 5. The question marks in the cells after the 5th cell indicate that it does not matter what numbers are in those cells when the function returns.

Show us that you have done some work on this by yourself. Post up a program that creates an array, fills it (either hardcoded or by user input) and then your attempt at removing duplicates. After that I will be able to help you out, otherwise you will learn nothing.

i tried and stopped here
my problem in the function remove_duplicates what should i write inside it

#include <iostream>
using namespace std;

void remove_duplicates ( int h[] ,int size ,int &count ){

    for (int i = 0 ; i < size  ; i++ )
        for(int j = 1 ; j<size ; j++)



}


int main () { 

const int size =20;

int h[size], count, i,n;

cout<<"PLease enter size of an array"<<endl;

cin>>n;

cout << "Please enter in a series of numbers "<<endl;

for(i = 0; i < n; i++)

cin >>h[i];


remove_duplicates (h,n,count);

return 0 ;



}

how to adjust the array , remove duplicates and count the duplicates

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.