![]() |
|
|
|
Thread Tools | Display Modes |
|
|
|
|
#1 |
|
Newbie
Join Date: Dec 2006
Posts: 3
Rep Power: 0
![]() |
Trouble with while loop.
Hi. I am new to this forum. I have written a program to calculate the outstanding balance, interest payment, and principal payment for a loan. When I compile it does not display any results. I believe the error is in my while loop but I have not had any luck locating the error.
int main()
{
float OUTSTANDING_BAL = 80000.000000;
const float MONTHLY_PYMT = 300.000000;
float principal;
float monInt;
float balance;
cout << "Beginning Interest Principal EndingLoan" << endl;
cout << "Payment Payment Balance Balance" << endl;
cout << "_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _" << endl;
balance = OUTSTANDING_BAL;
while (balance <= 80000.000000)
{
balance = balance - MONTHLY_PYMT;
monInt = balance * (0.10/12);
if (balance < MONTHLY_PYMT)
principal = balance;
else
principal = MONTHLY_PYMT - monInt;
balance= balance - principal;
cout << setiosflags(ios::fixed)
<< setiosflags(ios::showpoint)
<< setw(11) << setprecision(6);
}
return 0;I would appreciate any help that I can get. |
|
|
|
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Beginner's trouble with software delays (TCNT) | JoeSmith | Assembly | 0 | May 12th, 2005 1:26 AM |
| Help in QBASIC (I think it's similar to VB) | phoenix987 | Visual Basic | 3 | May 9th, 2005 1:33 PM |
| Help with a QBASIC program | phoenix987 | Other Programming Languages | 4 | May 5th, 2005 1:27 PM |
| WinSock accept() hangs program in Do loop... | layer | C++ | 5 | Apr 29th, 2005 12:28 PM |
| Timing loop problems | badbasser98 | C++ | 11 | Mar 10th, 2005 9:30 PM |