Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Need help writing these function with certain instruction in it. It is required to implements a Pokedex.cpp class Pokedex { public: // constructor - create

Need help writing these function with certain instruction in it. It is required to implements a Pokedex.cpp

class Pokedex {

public:

// constructor - create empty Pokedex

Pokedex();

// Return size

int size() const;

// Return maximum size, capacity of Pokedex

static int max_size();

// return true if Pokedex is empty

bool empty() const;

// return pokemon at given index

// undefined behaviour for n < 0 or n >= size

const string &at(int n) const;

// return pokemon at the front, alphabetically first one

const string &front() const;

// return pokemon at the front, alphabetically last one

const string &back() const;

// Add pokemon to Pokedex, keep the Pokedex list sorted

// Can have multiple pokemon with the same name

// Pokemon is not inserted if Pokedex is already full

void insert(const string &pokemon);

// Delete the last element

void pop_back();

// Erase element at location, move other elements as needed

// undefined behaviour if given index is not valid

void erase(int n);

private:

// maximum capacity of Pokedex

static const int MAX = 10;

// sorted list of pokemon in Pokedex

string pokemons[MAX];

// current internal size

int msize = 0;

};

// insertion operator, so we can use "cout << pdx"

//ostream &operator<<(ostream &out, const Pokedex &pdx);

#endif // POKEDEX_H

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

Data Access Patterns Database Interactions In Object Oriented Applications

Authors: Clifton Nock

1st Edition

0321555627, 978-0321555625

More Books

Students also viewed these Databases questions

Question

2. Define identity.

Answered: 1 week ago

Question

1. Identify three communication approaches to identity.

Answered: 1 week ago

Question

4. Describe phases of majority identity development.

Answered: 1 week ago