Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Please make sure you have to write table.t File and you will have to create tableSpecificOps 1 . cpp and table.cpp as well. Question:Design a
Please make sure you have to write table.t File and you will have to create tableSpecificOpscpp and table.cpp as well. Question:Design a table ADT Specifically write a table class.It must be generic ie templated and contain all the necessary attributes and actions data members and member functions for the table class to behave as expected. You must write a table.t file that works for the provided files: tableSpecificOpsh table.h pair.h pair.cpp driver.cpp
you will have to create tableSpecificOpscpp and table.cpp as well This is tableSpecificOps.h #include "table.h
#ifndef TABLESPCIFICH
#define TABLESPCIFICH
int f char c;
int f double d;
#endif This is "pair.h #ifndef PAIRH
#define PAIRH
more or less from STL library
found in and
template class T class T
class Pair
public:
T first;
T second;
default constructor
Pair: first T second T
constructor that initializes first and second
Pair const T v const T v:
firstv secondv
copy constructor
template typename U typename U
Pair const Pair& X
: first Xfirst second Xsecond
overload
template typename U typename U
Pair& operator const Pair& init
return this Pairinit;
overload
friend bool operator const Pair& lhs const Pair& rhs
return lhsfirst rhsfirst rhsfirst lhsfirst && lhssecond rhssecond ;
overload
friend bool operator const Pair& lhs const Pair& rhs
return lhsfirst rhsfirst && lhssecond rhssecond ;
;
template class T class T
Pair makePair const T& v const T& v
return Pair T Tvv;
#endif This is "Driver.cpp sample driver which your lab should demo
#include
using std::cout;using std::cin;using std::endl;
#include "pair.h#include "table.h
where the mapping function is defined
#include "tableSpecificOpsh
int main
Table char, int t f;
Pair char, int pa; Pair char, int pd; Pair char, int pe;
tinsert p; tinsert p;
tprint;cout endl;
char someKey d; tremovesomeKey;
tprint;cout endl;
tinsert p;tprint; cout endl;
cout tlookUpe;cout endl;
cout tlookUpz; cout endl;
tinsert makePairb;
tprint; cout endl;
return ; Finaly, "table.h screenshot below Thank you so much
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started