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

Use the following code segment for your answers to two questions below: (C++) co

ID: 3645340 • Letter: U

Question

Use the following code segment for your answers to two questions below: (C++)

const int SIZE = 5;

template< class T >

class Mystery

{ public:

private:

T *what;

};

int main( )

{ int grades[ ] = { 100, 90, 87, 89, 60}; // LINE 1

Mystery object( grades); // LINE 2

cout << object << endl; // LINE 3

}

Questions:

1. The code on LINE 2 in the main() is supposed to copy all array elements of grades to the *what that is used as an array.

What is missing in the class Mystery? Come up with the implementation inside the class.

Explanation / Answer

const int SIZE = 5; template class Mystery { public: private: grades *what; }; int main( ) { int grades[ ] = { 100, 90, 87, 89, 60}; // LINE 1 Mystery object( grades); // LINE 2 cout
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote