Jump to content
Maintenance
  • Scythe Gaming is currently in beta
  • Please be patient until we finish the website

Files

Sign in to follow this  

2 files

  1. Week 5 Testing Function

    Week 5 Testing Function
    Note that the names of functions begin with lower case
    The following is the code that converts vectors into string:
     
     
     
    struct Book {
    public:
        std::string category;
        std::string title;
        std::string author;
        std::string toString() {
            return "\"" + this->title + "\" by " + this->author + " (" + this->category + ")";
        }
    };
     
     
     
    Paste the following into BookPile.cpp
    std::string BookPile::toString() { // This function converts all of the data inside the array into a string so it can be compared with other arrays
        std::string Output = "";
        for (Book b : BookPile::Stack) {
            Output = Output + b.toString();
        }
        return Output;
    }
     
     
    replace BookPile.h with the following...
    #pragma once
    class BookPile {
    public:
        virtual bool addBook(Book b); // Change 'virtual bool' to void if it breaks your code
        void removeBook();
        Book getNextBook();
        void listAllBooks();
        int getNumBooks();
        std::string toString();
    protected:
        std::vector<Book> Stack;
    };

    22 downloads

    Submitted

  2. Week2

    Week2 Source Code For University Assignment

    51 downloads

    Submitted

Sign in to follow this  

×
×
  • Create New...