Answered step by step
Verified Expert Solution
Question
1 Approved Answer
I need help with this lab my code is not working ? ? ? Please use this code and correct it whatever are there worng
I need help with this lab my code is not working Please use this code and correct it whatever are there worng Run the code show its work successfully I need all the code which you are going use to run the program I need all the code & output too which show as program work successfully Please I need Full code and output and Thank You 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 MY Code : "pair.h #pragma once
#ifndef PAIRH
#define PAIRH
template
class Pair
public:
T first;
T second;
Pair : firstT secondT
Pairconst T v const T v : firstv secondv
template
Pairconst Pair& X : firstXfirst secondXsecond
template
Pair& operatorconst Pair& init
return this Pairinit;
friend bool operatorconst Pair& lhs const Pair& rhs
return lhsfirst rhsfirst rhsfirst lhsfirst && lhssecond rhssecond;
friend bool operatorconst Pair& lhs const Pair& rhs
return lhsfirst rhsfirst && lhssecond rhssecond;
;
template
Pair makePairconst T& v const T& v
return Pairv v;
#endif My next code "table.h #pragma once
#ifndef TABLEH
#define TABLEH
#include
#include "pair.h
template
class Table
public:
typedef Key keytype;
private:
int tableSize;
Pair thetable;
int MappingKey k;
public:
void print;
Tableint n int mapKey k;
bool insertPair kvpair;
bool removeconst Key aKey;
T lookUpconst Key aKey;
Tableconst Table& initTable;
~Table;
Table& operatorconst Table& initTable;
;
#include "table.t
#endif My code "table.t #ifndef TABLET
#define TABLET
#include "table.h
template
void Table::print
for int i ; i tableSize; i
std::cout thetableifirst : thetableisecond std::endl;
template
Table::Tableint n int mapKey k : tableSizen Mappingmap
thetable new PairtableSize;
template
bool Table::insertPair kvpair
int index Mappingkvpairfirst;
if index && index tableSize
thetableindex kvpair;
return true;
return false;
#endif This is my "tableSpecificOpscpp #include "tableSpecificOpsh
#include "tableSpecificOpsh
int fchar c
Function body
return c;
int fdouble d
Function body
return d;
This is my "tableSpecificOpsh #pragma once
#ifndef TABLESPCIFICH
#define TABLESPCIFICH
int fchar c;
int fdouble d;
#endif This is my Driver.cpp screenshot
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