I have the following code which removes duplicates from an array:
#include <iostream>
#include <algorithm>
#include <vector>
#include <iterator>
using namespace std;
char main()
{
char myarray[10] = {'a', 'b', 'b', 'b', 'b', 'c'};
int myarraylength = 5;
string holdprogram;
vector< char > myvector(myarray, myarray + (myarraylength + 1));
ostream_iterator< char > output(cout, " ");
copy(myvector.begin(), myvector.end(), output);
vector< char >::iterator endpoint;
endpoint = unique(myvector.begin(), myvector.end());
cout << endl;
copy(myvector.begin(), endpoint, output);
cin >> holdprogram;
}
What I'm looking to find out is what is the new size of the array once the duplicates are removed?