In my printf, I need to use %f but I\'m not sure how to truncate to 2 decimal places:
printf
%f
Example: getting
3.14159
Try:
printf("%.2f", 3.14159);
Reference:
http://www.cplusplus.com/reference/clibrary/cstdio/printf/