(up beat music)
- [Narrator] For this challenge you will
create a data structure
for a library catalog card.
Most libraries used to have a card catalog,
large cabinet of drawers filled with three by five cards
where you'd lookup a book by title or author.
Today this is mostly online,
but many libraries still use card catalogs.
Each card looks something like this
with the title of the book,
the author,
publisher and other relevant information.
For our catalog card,
we will carry the following information.
The title of the book,
the author,
the publisher,
the subject,
the international standard book number
is common identifier for books.
WorldCat or OCLC is another common identifier for books.
The Dewey Decimal system is common in physical libraries,
the year of publication,
the year the book was acquired by this library.
And how many copies we have in stock.
You'll need to decide on a data type
for each element in the structure.
I'm not going to tell you what type to use for each item,
but here is some general guide lines.
A C-string is useful for anything text based
or anything that should be displayed in a certain format.
Integers are good for numerical items that may be used
as an uperhand in a mathematical expression.
And as we're thinking about something like
the Dewey Decimal format,
this is two separate numbers
which each have numerical properties,
again use your best discretion.
We'll talk about print f in more detail later on
but for now here's a couple of useful tips.
Use percent s as a format specifier for C-strings,
and use percent d for integers.
The back slash n,
is a new line character,
this advances the cursor to the next line.
The purpose of this challenge is for you to use
your knowledge of C++ data types,
to choose those data types that work best in this context.
I expect this challenge to take you about 15 minutes,
or maybe longer if it takes longer that's fine.
Take your time,
experiment a lot,
and I'll show you my solution in the next movie.