From the course: C Essential Training
Unlock the full course today
Join today to access over 23,200 courses taught by industry experts.
Solution: Library card - C Tutorial
From the course: C Essential Training
Solution: Library card
(bright music) - [Instructor] Here's my solution for library catalog card challenge. This is 04-solution.cpp from chapter four of the exercise files. The structure for the card catalog card is at the top. It doesn't need to be here. You could have put it inside the main function and that would work also. The structure is pretty simple. I've used const care pointers for the strings and short integers for the numeric values. You could have also used character rays for the strings, simple ints would've worked fine for the numerics as well. Notice that the Dewey decimal value is two separate integers. This allows me to sort them more easily. These are numeric values and they're used that way. I print everything using cout and format as we've been doing throughout this course. And you notice that the Dewey decimal value is two integers separated by a period. Go ahead and run this and you can see my result here. So this is…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
Overview of data types3m 21s
-
(Locked)
Integer types2m 43s
-
(Locked)
Floating point types6m 51s
-
(Locked)
The auto type4m 2s
-
(Locked)
Qualifiers4m 33s
-
(Locked)
Type aliases2m 5s
-
(Locked)
Primitive arrays5m 23s
-
(Locked)
C-strings4m 37s
-
(Locked)
Structures2m 50s
-
(Locked)
Challenge: Library card2m 9s
-
(Locked)
Solution: Library card1m 16s
-
-
-
-
-
-
-