Showing posts with label chapter 11 drill. Show all posts
Showing posts with label chapter 11 drill. Show all posts

Sunday, 23 February 2020

Chapter 11 // Drill 10 - Principles & Practice Using C++

In this exercise I am using Visual Studio Community 2017 and the header file "std_lib_facilities.h" which can be found here:

http://www.stroustrup.com/Programming/PPP2code/std_lib_facilities.h

Chapter 11 // Drill 10

Make a small table including last name, first name, telephone number and email address for yourself and at least five of your friends. Experiment with different field width until you are satisfied that the table is presented well.


This drill seemed a little pointless to me seeing as how I don't see how setw() can be useful outside of the console window. And unfortunately DOS isn't all that popular anymore. You can still use it with user defined streams like ostream but whatever. Handy to know when I start making all my console window games...

Saturday, 22 February 2020

Chapter 11 // Drill 9 - Principles & Practice Using C++

In this exercise I am using Visual Studio Community 2017 and the header file "std_lib_facilities.h" which can be found here:

http://www.stroustrup.com/Programming/PPP2code/std_lib_facilities.h

Chapter 11 // Drill 9

Write some code to print the number 1234567.89 three times, first using defaultfloat, then fixed, then scientific forms. Which output form presents the user with the most accurate representation? Explain why.


This exercise made me wonder why anyone would use float if they need precision from floating point numbers. Sure float is smaller than double so you would be saving bytes however you lose precision.

Friday, 21 February 2020

Chapter 11 // Drills 1,2,3,4,5,6,7,8 - Principles & Practice Using C++

In this exercise I am using Visual Studio Community 2017 and the header file "std_lib_facilities.h" which can be found here:

http://www.stroustrup.com/Programming/PPP2code/std_lib_facilities.h

Chapter 11 // Drills 1,2,3,4,5,6,7,8
These drills were very easy...a little to easy. It made me suspicious.