Lesson 4: Adding on using IOManip

[spoiler title=”Lesson Video”]
Direct Download of Video (For mobile / offline viewing)(right click > save target as)


[/spoiler]

[spoiler title=”Lesson Source Code”]

[/spoiler]



IOManip
In this lesson we covered iomanip (full listing of functions in library here: http://www.cplusplus.com/reference/iomanip/). The 4 functions that we set our sights on were

  1. showpoint (via setiosflags)
  2. fixed(via setiosflags)
  3. setprecision
  4. setw


Showpoint
Showpoint is an ios flag that forces the console to show the numbers after the decimal point. This is true even with integer numbers that do not have a decimal point


Fixed
Fixed is an ios flag that forces the console to show a certain amount of numbers after the decimal point


setprecision
Setprecision is a function that specifies the minimum precision (points after the decimal) you will allow it to print.


setw
Setw is a function used for formatting tables. It automatically adds a certain number of spaces. You can also change the fill using setfill (linked in the reference above)