I am tasked to create a Print function that prints user inputted data that is specific to an object. This print function must use the Get() Function commands I created.
I have googled and looked for similar questions but could not find a way of how I could approach this. How can I create this function my teacher wants?
The object I want to print specifically is book1
My code:
     #include <iostream>
     #include <string>
     #include <cstdio>
     using namespace std;
       class Book {
       public:
       void SetTitle(string title_input);
       string GetTitle();
       void SetAuthor(string& author_input);
       string GetAuthor();
       void SetCopyRightYear(int copyright_year_input);
       int GetCopyRightYear();
       void PrintBook();
       private:
       string title;
       string author;
       int copyright_year;
    };
     void Book::SetTitle(string title_input) {
           title = title_input;
       }
         string Book::GetTitle() {
             return title;
         }
         void Book::SetAuthor(string& author_input) {
             author = author_input;
         }
         string Book::GetAuthor() {
             return author;
         }
         void Book::SetCopyRightYear(int copyright_year_input) {
             copyright_year = copyright_year_input;
         }
         int Book::GetCopyRightYear() {
             return copyright_year;
         }
         void Book::PrintBook() {
             cout << "Title of Book: " << GetTitle() << endl;
             cout << "Author of Book: " << GetAuthor() << endl;          // Function is broken FIXME
             cout << "Copyright Year: " << GetCopyRightYear() << endl;
         }
    int main ()
    {
        string title_input = "";
        string author_input = "";
        int copyright_year_input = 0;
        Book book1;
        Book book2;
        Book book3;
        Book book4;
        cout << "Enter the book title: ";
        cin >> title_input;
        book1.SetTitle(title_input);
        cout << book1.GetTitle();
        cout << "Enter the author name: ";
        cin >> author_input;
        book1.SetAuthor(author_input);
        cout << "Enter the copyright year: ";
        cin >> copyright_year_input;
        book1.SetCopyRightYear(copyright_year_input);
        cout << PrintBook();
 
    