Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

 
 
Thread Tools Display Modes
Prev Previous Post in Thread   Next Post in Thread Next
Old Dec 11th, 2006, 11:39 PM   #1
amg11872
Newbie
 
Join Date: Dec 2006
Posts: 3
Rep Power: 0 amg11872 is on a distinguished road
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.
amg11872 is offline   Reply With Quote
 

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

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




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 6:00 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC