Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Can someone please help me out with C++. Please try to make the code easy to und

ID: 3762269 • Letter: C

Question

Can someone please help me out with C++. Please try to make the code easy to understand and provide the output screen what it's look like, I'm still learning programming. Thank you.

     Create a class template that contains two private data members: T * array and int size. The class uses a constructor to allocate the array based on the size entered.   There is member function that allows the user to fill in the array based on the size. In addition, there is a member function that sorts the array and displays the sorted elements. Use the destructor to delete the array. Develop the main ( ) to create two objects to call member functions. As a result, the first object will hold its array of double type, and the other will hold its array of the int type.

Explanation / Answer

template<typename T> class Tarray { private: const int start_size; T* this_array; int array_size; Tarray( const Tarrat& inObj ); // no copy public: Tarray(int s): start_size(s), this_array( new T[s] ) { } ~Tarray(){ delete[] this_array; } T & operator[](int i){ return this_array[i]; } }; int main() { Tarray t1=new Tarray(10); t1 int[] thisarray; t1 double[] thisarray1; sort(thisarray); sort(thisarray1); } void sort(T *A, int size) { T min =453; T temp=0; bool swapper = false; int index1 = 0, index2 = 0; for (int ii = 0; ii < size-1; ii++){ for (int jj = ii + 1; jj < size; jj++){ if((min >= (A[ii]+A[jj])) && (A[ii] > A[jj])){ min = (A[ii]+A[jj]); index1 = ii; index2 = jj; swapper = true; } } } if (!swapper) return; else { temp = A[index1]; A[index1] = A[index2]; A[index2] = temp; sort(A,size); } }