WRITE A C++ CODE OF THE FOLLOWING PROGRAM.

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899604
Joined: Mon Aug 02, 2021 8:13 am

WRITE A C++ CODE OF THE FOLLOWING PROGRAM.

Post by answerhappygod »

WRITE A C++ CODE OF THE FOLLOWING PROGRAM.
Write A C Code Of The Following Program 1
Write A C Code Of The Following Program 1 (150.53 KiB) Viewed 43 times
Q 3: Implementation of True Dynamic Array Class - Your goal is to implement a generic “DynamicArray" class. This will allow you to increase the size of the array whenever you want to add another integer to it. You will need to write three files (DynamicArray.h, DynamicArray.cpp and Q3.cpp). Your implemented class must fully provide the definitions of following class (interface) functions. Please also write down the test code to drive your class implementation. Please note that we will be running your code against our test code and any segmentation faults or incorrect result will result in loss of marks. Data Next Data Next Data Next NULL HEAD struct node{ int value; node* next; }; class DynamicArray{ private: // think about the private data members... public: // provide definitions of following functions... DynamicArray();// a default constructor DynamicArray (int size);// a parametrized constructor initializing an Array DynamicArray (int *arr, int size);// initializes the Array with an existing DynamicArray (const DynamicArray &);// copy constructor const int operator[](int i) const;// returns the integer at index int& operator[](int); // set the value at index DynamicArray& operator() (int pos, int size);// returns subArray of 'size' from pos' DynamicArray& operator() (int pos);// returns a sub-Array from `pos’ to end

DynamicArray& operator+=(int a);// adds an element to the end of the array int operator-= (); // removes and returns the last element of the array operator string(); //this should print the matrix in correct format operator int(); // returns the size of the Array bool operator==(DynamicArray&);// should return true if both Arrays are same bool operator!= (DynamicArray&); // compares if the length of two arrays is same returns true if not DynamicArray(); };
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply