#include <iostream> using namespace std; struct HashEntry { tableSize = 0; strin
ID: 3610029 • Letter: #
Question
#include <iostream>using namespace std;
struct HashEntry
{
tableSize = 0;
string item;
EntryType info;
};
class Dictionary
{
public:
enum EntryType {ACTIVE, EMPTY, DELETED};
Dictionary();
// Creates an empty dictionary;
private:
int tableSize;
};
/************Class file **************************/
// Implementation file for AVL search tree
#include "Dictionary.h"
#include <fstream>
#include <cctype>
using namespace std;
Dictionary::Dictionary()
{
}
HashEntry* Dictionary::rehash()
{
HashEntry *newTable;
newTable = new HashEntry[tableSize];
//Copy contents
for(int i = 0; i < tableSize; i++)
if(HashTable[i].info == HashEntry.ACTIVE)
{//insert
int index = findNextPos(HashTable[i].item);
}
delete [] HashTable;
return newTable;
}
This is just the part of the code giving me the problem.
Any ideas would be greatly appreciated.
Thanks in advance
Explanation / Answer
/* I highlighted the changes you have to do to make the programwotrk correctly.....and also wrote the reasons in comments */ #include #include /////include the string header file using #include using namespace std; enum EntryType {ACTIVE, EMPTY, DELETED}; //declare enum here struct HashEntry { // tableSize = 0; here you should include atype (like int tableSize) and also in structs you should not//initialize a variable (int tableSize = 0; is wrong in astruct but int tableSize; is correct....) int tableSize ; string item; EntryType info; //The enum EntryType isdefined inside a class, therefore EntryType is not available in thestruct.so define the enum outside class before thestruct }; class Dictionary { public: EntryType e; //Initialize an EntryTypeVariable Dictionary(); // Creates an empty dictionary; private: int tableSize; };Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.