#include <iostream>
using namespace std;
void ElimDuplicates( int array[], int n);
//Pre Condition: receives a sorted array containing duplicates
//Post Condition: eliminates duplicates from array and then returns array
int main()
{
const int SIZE = 10;
int a[SIZE]={1, 1, 1, 2, 3, 3, 4, 6, 6, 7};
cout << “Before removing duplicates, array contains: ” << endl << a[SIZE];
ElimDuplicates(a, SIZE);
cout << endl<< "After removing duplicates, array contains: ” << endl << a[SIZE];
return(0);
}
void ElimDuplicates(int array[], int n)
{
for ( int i = 0 ; i < n ; i++ )
for ( int j = 0 ; j <=i ; j++ )
if ( array [ j ] == array [ i ] )
array[j]=0;
}
CiNpbmNsdWRlIDxpb3N0cmVhbT4KdXNpbmcgbmFtZXNwYWNlIHN0ZDsKCnZvaWQgRWxpbUR1cGxpY2F0ZXMoIGludCBhcnJheVtdLCBpbnQgbik7Ci8vUHJlIENvbmRpdGlvbjogcmVjZWl2ZXMgYSBzb3J0ZWQgYXJyYXkgY29udGFpbmluZyBkdXBsaWNhdGVzIAovL1Bvc3QgQ29uZGl0aW9uOiBlbGltaW5hdGVzIGR1cGxpY2F0ZXMgZnJvbSBhcnJheSBhbmQgdGhlbiByZXR1cm5zIGFycmF5CgppbnQgbWFpbigpCnsKCWNvbnN0IGludCBTSVpFID0gMTA7CglpbnQgYVtTSVpFXT17MSwgMSwgMSwgMiwgMywgMywgNCwgNiwgNiwgN307Cgljb3V0IDw8IOKAnEJlZm9yZSByZW1vdmluZyBkdXBsaWNhdGVzLCBhcnJheSBjb250YWluczog4oCdIDw8IGVuZGwgPDwgYVtTSVpFXTsKCUVsaW1EdXBsaWNhdGVzKGEsIFNJWkUpOwoJY291dCA8PCBlbmRsPDwgIkFmdGVyIHJlbW92aW5nIGR1cGxpY2F0ZXMsIGFycmF5IGNvbnRhaW5zOiDigJ0gPDwgZW5kbCA8PCBhW1NJWkVdOyAKICAgIHJldHVybigwKTsKfQoKCnZvaWQgRWxpbUR1cGxpY2F0ZXMoaW50IGFycmF5W10sIGludCBuKQp7CiAgICAgZm9yICggaW50IGkgPSAwIDsgaSA8IG4gOyBpKysgKSAKICAgICAgICBmb3IgKCBpbnQgaiA9IDAgOyBqIDw9aSA7IGorKyApIAogICAgICAgICAgICBpZiAoIGFycmF5IFsgaiBdID09IGFycmF5IFsgaSBdICkgCiAgICAgCSAgICAgICAgYXJyYXlbal09MDsKfQogICAgICAgICAK
prog.cpp:13:2: error: stray '\342' in program
cout << “Before removing duplicates, array contains: ” << endl << a[SIZE];
^
prog.cpp:13:2: error: stray '\200' in program
prog.cpp:13:2: error: stray '\234' in program
prog.cpp:13:2: error: stray '\342' in program
prog.cpp:13:2: error: stray '\200' in program
prog.cpp:13:2: error: stray '\235' in program
prog.cpp:15:17: warning: missing terminating " character
cout << endl<< "After removing duplicates, array contains: ” << endl << a[SIZE];
^
prog.cpp:15:2: error: missing terminating " character
cout << endl<< "After removing duplicates, array contains: ” << endl << a[SIZE];
^
prog.cpp: In function 'int main()':
prog.cpp:13:13: error: 'Before' was not declared in this scope
cout << “Before removing duplicates, array contains: ” << endl << a[SIZE];
^
prog.cpp:16:5: error: expected primary-expression before 'return'
return(0);
^