(lively soft music)
- Let's take a look at my solution
for the library catalog card problem.
This is O3-solution from chapter three
of the exercise files.
The structure for the catalog card is here at the top.
It doesn't need to be,
it could be inside the main function if you prefer.
And that would work too.
The structure is actually pretty simple.
I've used const char pointers for the C strings.
I could also have use character res for the strings
and that would work fine.
I've used short int for the numerics
and simple ins would work fine for that as well.
So that would be a perfectly acceptable answer.
And you notice for the Dewey Decimal values,
I've used two separate integers.
This allows me to sort them more easily.
These are numeric values and they are used that way.
I initialized one element with a initializer list,
and then I print all the values with print F
using percent D for the numerics
and percent S for the strings.
So when I build and run, you notice I get this result.
So book I wrote many, many years ago,
would I say here in 1996, 24 years ago.
And there we go. That's my solution.
Yours may be similar, it may be different
as long as it works.
And hopefully you've learned something from the process.