Numeric Array - Remove Duplicate Elements (2007)

Define a class Duplicate to pack an array of 10 integers which are sorted (To pack means to remove all duplicates from the array). For eg., if the given array has the following sorted numbers:

           1  2  3  3  4  4  4  5  6  6

  the resultant array should contain each elements ones. The output should be :

                        1  2  3  4  5  6

 Some of the members of the class are given below:-

Class name                               : Duplicate

Data members                                 

       num[ ]                               : integer array with 10 integers sorted 

Functions/methods:

       void readList( )                 : to enter elements of the array in sorted order.

       void packList( )                : to remove the duplicates from the.

       void dispList( )                 : to display the array of integers without the duplicates.

 

Specify the class Duplicate giving the details of the function void readList( ),

void packList( ) and void dispList( ). The main function need not be written.