Implement a class Sequence to store a sequence of non-negative integer values, and the length of the sequence. The class has the following private data members:
1. int length – the length of the sequence
2. int *pseq – a pointer to a dynamic integer array holding sequence of integer:
1.Sequence() – a default constructor that initializes length to 10 and store the sequence of all zeros in an array.
2. Sequence(int lengthVal, int n1=0,int n2=0,int n3=0, int n4=0, int n5=0, int n6=0, int n7=0, int n8=0, int n9=0, int n10=0) –
3. Sequence(Sequence &s) –
4. int getLength() – a getter for length
5. int* getSeq() – a getter for the sequence of numbers
6. void Sort(int n) –
7. int RemoveDuplicates() –
8. void Rotate(int steps) – a method that rotates the sequence elements clockwise for the
9. ~Sequence() – a destructor to deallocate the dynamically created array
Here is program:
class Sequence
{
public:
Sequence(int lengthVal, int n1 =0, int n2 = 0, int n3 = 0, int n4 = 0, int n5 = 0, int n6 = 0, int n7 = 0, int n8 = 0, int n9 = 0, int n10 = 0)
{
}
Sequence(Sequence &s);
int getLength()
{
return length;
}
int* getSeq()
{
}
void Sort(int n)
{
}
int RemoveDuplicates()
{
}
void Rotate(int steps)
{
}
~Sequence();
private:
int length;
int* pseq;
};
Comments
Leave a comment