Pages

Principles & Practice

Below is a quick list of all the exercises I have done from Principles & Programming (2nd Edition). If there is no link but the exercises/drill is listed it is because I am still working on it or the post is scheduled:

EDIT - As of September 2019, I am re-doing the entire book and posting all exercises/drills onto Github as it's easier to read the code. Blogger does not really support code all that well and it's getting annoying with later chapters as they have multiple files within one program. The below exercises will be kept for historical purposes but I've realised that some of them are wrong...I did do them a very long time ago and with little to no knowledge of programming (although now I have a job as a programmer it feels as though 3 years is still pretty much no knowledge). 

https://github.com/l-paz91/principles-practice

EDIT 14/01/2020 - I have now caught up to where I left off and will continue posting individual exercises on here but with links to the git.

EDIT 02/03/2020 - I have now started on Chapter 12 and discovered that the graphics files needed don't compile. I fixed them and cleaned them up here:
https://github.com/l-paz91/principles-practice/tree/master/Graphics%20Files

EDIT 01/01/2021 - I've added some full projects to github that you can download for help with FLTK:

EDIT 06/01/2021 - I can't believe the page title has been incorrectly spelt for 5 years....

EDIT 01/04/2024 - I finally finished the book in November 2023. I've started doing the "main" one; The C++ Programming Language.

EDIT 03/05/2024 - Bjarne has released a new edition of the book, just after I finished it...Anyway, all the exercises below are done using the Second Edition (released 2014). In the 3rd Edition, he uses the Qt library instead of FLTK. For the most part the code appears to be implemented in the same way but there are differences.

Chapter 2/3
Chapter 2 Drill
Chapter 3 Drill
Chapter 3 Exercises

Chapter 4 - Drill
Drill // 4.1 + 4.2 + 4.3 + 4.4
Drill // 4.5
Drill // 4.6
Drill // 4.7
Drill // 4.8
Drill // 4.9
Drill // 4.10 & 4.11

Chapter 4 Exercises
Exercise // 1 - Try This
Exercise // 2
Exercise // 3
Exercise // 4
Exercise // 5
Exercise // 6
Exercise // 7
Exercise // 8, 9
Exercise // 10
Exercise // 11, 12, 13, 14, 15
Exercise // 16
Exercise // 17
Exercise // 18
Exercise // 19, 20, 21

Chapter 5 Exercises
Exercise  // 1-  Try This - these are pretty specific to your compiler so I haven't posted this one.
Exercise // 2, 3, 4, 5, 6
Exercise // 7
Exercise // 8, 9, 10
Exercise // 11
Exercise // 12, 13
Exercise // 14

Chapter 6 - Drill
Drill // 1
Drill // 2, 3, 4, 5

Chapter 6 Exercises
Exercise // 2
Exercise // 3
Exercise // 4
Exercise // 5, 6
Exercise // 7
Exercise // 8
Exercise // 9
Exercise // 10

Chapter 7  - Drill
Drill // 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11

Chapter 7 - Exercises
Exercise // 1, 2, 3
Exercise // 4
Exercise // 5
Exercise // 6
Exercise // 7, 8, 9, 10, 11

Chapter 8 - Drill
Drill //1
Drill //2
Drill //3

Chapter 8 - Exercises
Exercise // 1
Exercise // 2
Exercise // 3, 4
Exercise // 5, 6
Exercise // 7, 8
Exercise // 9
Exercise // 10
Exercise // 11
Exercise // 12
Exercise // 13
Exercise // 14

Chapter 9 - Drill
Drill // 1, 2, 3, 4, 5

Chapter 9  - Exercises
Exercise // 1 - Skipped, subjective
Exercise // 2
Exercise // 3
Exercise // 4
Exercise // 5
Exercise // 6
Exercise // 7
Exercise // 8
Exercise // 9
Exercise // 10
Exercise // 11
Exercise // 12
Exercise // 13
Exercise // 14
Exercise // 15
Exercise // 16

Chapter 10 - Drills
Drill // 1, 2, 3, 4, 5, 6, 7

Chapter 10 - Exercises
Exercise // 1
Exercise // 2
Exercise // 3
Exercise // 4
Exercise // 5
Exercise // 6
Exercise // 7
Exercise // 8
Exercise // 9
Exercise // 10
Exercise // 11

Chapter 11 - Drills
Drill // 1, 2, 3, 4, 5, 6, 7, 8
Drill // 9
Drill // 10

Chapter 11 - Exercises
Exercise // 1
Exercise // 2
Exercise // 3
Exercise // 4
Exercise // 5
Exercise // 6
Exercise // 7
Exercise // 8
Exercise // 9
Exercise // 10
Exercise // 11
Exercise // 12
Exercise // 13
Exercise // 14
Exercise // 15
Exercise // 16

Chapter 12 Extras
Guide on installing FLTK 1.3.5
Guide on fixing errors within the graphics files
Notes on examples in Chapter 12

Chapter 12 - Drills
Drill // 1
Drill // 2, 3

Chapter 12 Exercises
Exercise // 1
Exercise // 2
Exercise // 3
Exercise // 4
Exercise // 5
Exercise // 6
Exercise // 7
Exercise // 8
Exercise // 9
Exercise // 10
Exercise // 11
Exercise // 12
Exercise // 13

Chapter 13 Drills
Drill // 1, 2
Drill // 3
Drill // 4
Drill // 5

Chapter 13 Exercises
Exercise // 1
Exercise // 2
Exercise // 3
Exercise // 4
Exercise // 5
Exercise // 6
Exercise // 7
Exercise // 8
Exercise // 9
Exercise // 10
Exercise // 11
Exercise // 12
Exercise // 13
Exercise // 14
Exercise // 15
Exercise // 16
Exercise // 17
Exercise // 18
Exercise // 19

Chapter 14 Drills
Drill // 1,2,3,4,5,6,7

Chapter 14 Exercises
Exercise // 1
Exercise // 2, 3
Exercise // 4
Exercise // 5
Exercise // 6
Exercise // 7
Exercise // 8
Exercise // 9
Exercise // 10
Exercise // 11
Exercise // 12
Exercise // 13
Exercise // 14
Exercise // 15
Exercise // 16
Exercise // 17

Notes on Chapter 15

Chapter 15 Drills
Function Graphing Drills - 1, 2, 3, 4, 5
Shape Function Graphing Drills - 1, 2, 3, 4, 5, 6, 7, 8, 9
Class Definition Drills - 1, 2, 3, 4, 5, 6, 7
Class Definition Drills - 8
Class Definition Drills - 9

Chapter 15 Exercises
Exercise // 1
Exercise // 2
Exercise // 3
Exercise // 4
Exercise // 5
Exercise // 6, 7
Exercise // 8
Exercise // 9
Exercise // 10
Exercise // 11

Chapter 16 Drills:
Drill // 1, 2, 3, 4

Chapter 16 Exercises:
Exercise // 1
Exercise // 2
Exercise // 3
Exercise // 4
Exercise // 5
Exercise // 6
Exercise // 7
Exercise // 8
Exercise // 9
Exercise // 10

Chapter 17 Drills:
Part 1 Drills



Chapter 19 Drills:

Chapter 19 Exercises:

Chapter 20 Drills:

Chapter 20 Excises:

Chapter 21 Drills:

Chapter 21 Exercises:
Chapter 22 Exercises:
(No drills in C22)
Exercise // 16 (skipped for the moment because I just can't be bothered)

Chapter 23 Drills:

Chapter 23 Exercises:

Chapter 24 Drills:

You can find the Matrix files used in the book here:
or here:

Chapter 24 Exercises:

Chapter 25 Drills:

Chapter 25 Exercises:

Chapter 26 Drills:

Chapter 26 Exercises:




















15 comments:

  1. This comment has been removed by the author.

    ReplyDelete
  2. Why did you stop posting after chapter 6 Drills?
    What happened

    ReplyDelete
    Replies
    1. Hi! Thanks for dropping by, university happened unfortunately. I'm halfway through chapter 7 but I'm currently focusing on my assignments. I'm hoping to start adding some more posts after Christmas but uni is taking up all of my time.

      Delete
    2. hmmm... I can understand..
      Just wanted to tell you that your work is helpful!

      Delete
  3. I hope you will start posting solutions of other exercises soon....

    ReplyDelete
  4. Hello! Very impressed you are still working through this book. I stopped at chapter 4, and went to a simpler book - Bronson's First Book of C++. It was way easier to start off with, especially on the job. I have forked your repo - just to look at it. Good job.

    PS: having spent years on this book, what will you tell a beginner is the best book to start with C++ quick. I am guessing its not this one.

    Enjoy.

    ReplyDelete
    Replies
    1. Hello again! Thank you! It's getting to the point where it's my life ambition to finish this book lol, I've also been at it since 2016 now having restarted it 4 times.

      Strangely though, if I had to do it all again I wouldn't choose any other resource to learn C++. The exercises really make this book. They sometimes make me want to throw my PC in a fiery pit but I guess that's the point. The graphics chapters were excellent and Chapter 17 has really helped cement my understanding of pointers/references.

      Mainly though, I like how repetitive this book is regarding concepts; it will plant a seed, mention it somewhere else, make you do a small exercise and then fully introduce it.

      Delete
  5. All I can say is you are totally my hero for sticking with this!!!

    ReplyDelete
    Replies
    1. haha thank you :D one I'll finally finish this bloody book.

      Delete
  6. back again for another checkup, and I have to say - you are a legend in my book! Finishing this book would be a great accomplishment!

    ReplyDelete
    Replies
    1. Hello again! Slow but steady. I reckon another 6 months.

      Delete
  7. Hey, just wanted to express my gratitude for your work here. You were an excellent sanity check for me as I made my way through the book. I also learned a bunch of cool little things going through your code. I finally finished the entire book today and probably would have given up halfway though if I didn't have you as a reference to make sure I was even on the right track with some of the problems. I'll definitely be checking back to compare notes. Thanks again.

    ReplyDelete
    Replies
    1. Thank you very much :) but also congratulations! That's one hell of achievement. Have you been posting exercises as well? It's hard to find those who have finished the entire book, I use this repository as my "sanity check":
      https://github.com/bewuethr/stroustrup-ppp
      I mainly take a peek after I've finished the exercise as it's nice to see someone else's interpretation of the exercise. Hopefully I'll finish the book soon too; 6 years is far too long to complete a book lol.

      Delete
    2. I've been posting to a private repo. Its a complete mess right now, I had two false starts on the book and I changed format/styling multiple times, but I hope to go back at some point and clean it up for public consumption.
      The last chapter covering C kinda broke me mentally, so I ordered the K&R book "The C Programming Language" and I hope to take another crack at chapter 27 again as well. My sinister motivation is to see you struggle with that chapter and experience some form of catharsis. But hopefully that won't happen to you. :)

      Delete
    3. No problem with it being a mess! I've gone through several different styles over the years and all the early posts on here are wrong in some way. It's nice to see the growth though so I don't change it.

      The K&R book is interesting. I have the exercises to chapter one in my drafts from 2019. I remember desperately wanting to use strings and vector. Once I finish this book, it's on my list to do next so you will definitely get to see my struggles lol.

      Delete