Hello forum ,
Please solve the below queery.
A sorted array which has repated elements.
A[10] = {1,2,3,3,4,5,5,5,6,9,9}
i want to delete the duplicate elements and to genrate a new array.
i need the array sholud be like this
A[10] = {1,2,3,4,5,6,9}.
Please write the piece of code for above querry.
Thanks & Regards
Siva Ranganath.
CarloM
3
And what shell/language is this?
I am sorry to say for detailed information.
please do it in C or C++.
#include <iostream>
#include <algorithm>
const int SIZE = 21;
int main()
{
int vals = {1,2,3,5,6,8,3,7,9,0,6,5,7,5,3,5,7,5,2,4};
std::sort ( vals, vals + SIZE );
int *end = std::unique ( vals, vals + SIZE );
for ( int *it = vals; it != end; it++ )
std::cout<< *it <<' ';
std::cout<<std::endl;
}