need help with operator >> method

Hello, currently my operator >> method seem to be a problem.
title = string
authorCount = int
authors[] = string
publisher = string
yearPublish = short
hardcover = bool
price = float
isbn = string
copies = long

I am trying to read features of a book from a file, but for some reason when trying to cout the Book, i get hex values.

If I need extra information please let me know, I need this problem solved.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
  istream& operator >> (istream& is, Book& book){
    string input;
    int counter = 1;
    while (counter==1 && !is.eof()){
        getline(is, book.title);
        is >> book.authorCount;
        cin.ignore();
        for (int i=0; i<book.authorCount; i++){
            getline(is, book.authors[i]);
        }
        getline(is, book.publisher);
        is >> book.yearPublish;
        is >> book.hardcover;
        is >> book.price;
        cin.ignore();
        getline(is, book.isbn);
        is>> book.copies;
        getline(is, input);
    }
    return is;
}
when trying to cout the Book, i get hex values

Are you sure you are printing a book, and not a pointer to a book?
Last edited on
Topic archived. No new replies allowed.