Ch4_6 - cout.precision(2); while (t==true) {

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
#include <iostream.h> #include <conio.h> /************************************************** Name: Hung Truong Program: Ch4_6:Interest Due Instructor: Mr. Barkeshli Purpose: Input: Interest rate, initial balance, number of months Output: Interest due **************************************************/ bool t=true; char c; double inrate,bal; int month; double intdue(double rate,double bal, int month); // Calculate interest due by interest rate, initial balance and months main() { cout.setf(ios::fixed); cout.setf(ios::showpoint);
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: cout.precision(2); while (t==true) { cout&amp;lt;&amp;lt;&amp;quot;Enter Interest rate per month: &amp;quot;;cin&amp;gt;&amp;gt;inrate; cout&amp;lt;&amp;lt;&amp;quot;Enter Initial acount balance: &amp;quot;;cin&amp;gt;&amp;gt;bal; cout&amp;lt;&amp;lt;&amp;quot;Enter number of months: &amp;quot;;cin&amp;gt;&amp;gt;month; cout&amp;lt;&amp;lt;&amp;quot;Interest Due: &amp;quot;&amp;lt;&amp;lt;intdue(inrate/100,bal,month)&amp;lt;&amp;lt;endl; cout&amp;lt;&amp;lt;&amp;quot;You want to do it again(Y/N)? &amp;quot;;cin&amp;gt;&amp;gt;c; t=(c=='Y')|(c=='y'); } } double intdue(double rate, double bal, int month) { int i; double temp=bal; for (i=0;i&amp;lt;month;i++) temp=temp*(1+rate); return temp-bal; }...
View Full Document

Ask a homework question - tutors are online