Question
Project 1-bag directory error. So this is the instruction. I made ABag.h and BDictionary, but in the bagtestmain.cpp, it comes out with the error How
Project 1-bag directory error.
So this is the instruction.
I made ABag.h and BDictionary, but in the bagtestmain.cpp, it comes out with the error
How should I fix it without changing begtestmain.cpp???
ABag.h
#include
const size_t BAG_SIZE = 10;
#pragma once template
ABag(size_t size = BAG_SIZE) { maxSize = size; top = 0; bag = new E[maxSize]; } ~ABag() { delete[] bag; }
bool addItem(const E& item) { if (top != maxSize) { bag[top++] = item; return true; } else { return false; } }
bool remove(E& item) { bool isFound = false; for (int i = 0; i
bool removeTop(E& returnValue) { if (top != 0) { returnValue = bag[--top]; return true; } else { return false; } }
bool find(E& returnValue) const { bool isFound = false; for (int i = 0; i
bool inspectTop(E& item) const { if (top != 0) { item = bag[top - 1]; return true; } else { return false; } }
void emptyBag() { top = 0; }
bool operator+=(const E& addend) { return addItem(addend); }
int size() const { return top; }
int bagCapacity() const { return maxSize; } };
++++++++++++++++++++++++++
BDicitonary.h
#ifndef BDICTIONARY_H #define BDICTIONARY_H
#include "ABag.h" #include "kvpair.h" #include "dictionaryADT.h" #include
#pragma once template
// Reinitialize dictionary void clear() { bag->emptyBag(); }
bool insert(const Key& k, const V& v) { std::unique_ptr
bool remove(const Key& k, V& rtnVal) { std::unique_ptr
bool removeAny(V& returnValue) { std::unique_ptr
bool find(const Key& k, V& returnValue) const { std::unique_ptr
//Returning int size() { return bag->size(); } };
#endif
Implement a dictionary using a Bag-Project 4.7 in the text (modified) Use the bag ADT provided to create an array or vector-based implementation for bags. Then use your bag to implement the dictionary ADT provided you. The bag your dictionary uses to store its values must be of type KVpair. For example, "ABag
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