# Ch4_6 - cout.precision(2 while(t==true...

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

#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);
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<<"Enter Interest rate : ";cin>>inrate; cout<<"Enter Initial acount balance: ";cin>>bal; cout<<"Enter number of months: ";cin>>month; cout<<"Interest Due: "<<intdue(inrate/100,bal,month)<<endl; cout<<"You want to do it again(Y/N)? ";cin>>c; t=(c=='Y')|(c=='y'); } } double intdue(double rate, double bal, int month) { int i; double temp=bal; for (i=0;i<month;i++) temp=temp*(1+rate); return temp-bal; }...
View Full Document

## This note was uploaded on 03/20/2011 for the course CS 2 taught by Professor Barkeshli during the Spring '11 term at Pasadena City College.

Ask a homework question - tutors are online