Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ program Write definitions for all functions for the TOC class in the sseparate TOC.cpp file and implement driver in the source.cpp file. TOC.h #ifndef

C++ program

Write definitions for all functions for the TOC class in the sseparate TOC.cpp file and implement driver in the source.cpp file.

TOC.h

#ifndef _TOCpoiner_header #define _TOCpoiner_header using namespace std; static int size = 10; template < class T > class TOC { private: int num_used; int capacity; T* myArray; public: TOC(int size = 10); bool full(); bool ifempty(); int capacity1(); int currently_used(); T get(int y); void set(T x); void add(T x); int position(T x); void insertAt(T x, int y); void remove(int x); void display(); void helper(T*& ar); ~TOC(); }; #endif

Menu

cout << "What would you like to do with your myArray? Enter the corresponding number. Enter 0 to exit." << endl << endl; cout << "1. Fill the myArray or add an element" << endl; cout << "2. Display elements in the myArray" << endl; cout << "3. Check if the myArray is full" << endl; cout << "4. Check if the myArray is empty" << endl; cout << "5. Insert the element in the myArray." << endl; cout << "6. Remove the element from the myArray" << endl; cout << "7. Check the position of the chosen element in the myArray" << endl; cout << "8. Change chosen element in the myArray" << endl; cout << "9. Check the capacity of the myArray " << endl; cout << "10. Check how many elements are currently in the myArray" << endl; cout << "11. Print the element from the chosen position in the myArray" << endl;

I want C++ code and output.

those what i have. need to write code TOC.h with other 2 files in C++.

Thanks

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Databases Illuminated

Authors: Catherine M Ricardo, Susan D Urban

3rd Edition

1284056945, 9781284056945

More Books

Students also viewed these Databases questions