I've got a C++ program due in about an hour! I need help! I've got a 'do-while' within an if- else. I want an output statment after the do-while, but it's not outputting?!?!? Is there anybody out there with help?
#include <iostream>
using namespace std;
int main ()
{
float principal, interest, payment, minpay;
int months=0;
cout<<"How much will you borrow?"<<endl;
cin>>principal;
cout<<endl<<"What is the percent interest rate?"<<endl;
cin>>interest;
cout<<endl<<"And what will you pay per month?"<<endl;
cin>>payment;
cout<<endl<<endl;
minpay = ((interest/1200)*principal);
if (payment > minpay)
{
do
{
payment = payment - ((interest/1200)*principal);
principal = principal - payment;
months = months + 1;
}
while (principal > 0);
cout<<"It will take you "<<months<<" months to pay off your loan with payments of that size."<<endl;
}
else
cout<<"You must make payments of at least $"<<minpay<<", or you will never pay off your loan!"<<endl;
return 0;
}