You use the setprecision, setw and fixed manipulators defined in the <iomanip> header to control the formatting of numbers. Write a program that calculates the interest and principal payments on a simple loan. Your program should query the user for a percentage annual interest rate, an initial balance and monthly payment, then print out the following table:
Month Balance Interest Payment
1 $ 10050.00 $ 100.50 $ 500.00
2 $ 9650.5 $ 96.51 $ 500.00
3 $ 9247.01 $ 92.47 $ 500.00
4 $ 8839.48 $ 88.39 $ 500.00
Use setw to set each column width, and use fixed and setprecision to properly show dollars and cents.
Here is what I have so far:
#include <iostream>
#include <iomanip>
#include <math.h>
using namespace std;