Enter book title or type exit to quit
harry potter
Enter the published date.
Enter the year: 1985
Enter the month: 11
Enter the day: 06
Book added: harry potter - [6/11/1985]
winnie the pooh - [0/-917859203/1986530702]
- [14/11/1985]
dark knight - [2293456/4258160/0]
- [25/11/1985]
harry potter - [-1090492655/1986585725/2293700]
- [6/11/1985]
As can be seen from the output, my printBooks() is displaying some garbage data as well (bold).
You are doing something very strange.
You make two arrays:
1 2 3
Book books[SIZE];
Book date[SIZE];
You then proceed to put the title of the book in the books array, and the date for that book in the date array.
This means that for each book entry in the books array you have a good title but rubbish dates because no date is set in this array
and in the date array you have no title (because the default constructor for a string is an empty string) and good values for the date for that book
You then do a print out:
1 2 3 4 5 6
for (x = 0; x < SIZE; x++)
{
books[x].printBooks();
date[x].printBooks();
}
So you get alternating lines of good title with a rubbish date - followed by no title with a good date.