I am writing a program to tell how long it will take for a loan to be paid off supposing the desired loan is 100,000, the annual percentage rate is 6, and the monthly payment is 1,000. What happens is after I run the program, I get the output of "-24.60" after the last month is paid off. I'm trying to get it to where the last monthly payment is only enough to make the loan 0. Then I want the program to end.
#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
double balance, interest, monthlyPay, apr;
int month=1;
cout<< "How much would you like to borrow?" << endl;
cin>> balance;
cout<< "What is the annual percentage rate?" << endl;
cin>> apr;
cout<< "How much would you like to pay monthly?" << endl;
cin>> monthlyPay;
cout<< endl;
So I actually went another way around doing it. I got the problem fixed. Now my OTHER problem is I have to make it look pretty. I got all of my columns lined up, but when my numbers print, they're all out of wack. Here's what I have in this part: