/////////////////////////////////////////////////////////////// // interest.cpp - interest calculator // // Jim Fawcett, Instructor, CRI In-Plant Course, S'99 // // build: cl /GX interest.cpp // /////////////////////////////////////////////////////////////// #include using namespace std; void main() { cout << "\n Interest Calculator " << "\n =====================\n\n"; double loanValue; double interest; unsigned int numYears; cout << " loan value ($), interest (%), years: (0 0 0 to quit)\n"; cout.setf(ios::fixed,ios::floatfield); // use fixed notation cout.precision(2); // two digits after decimal while(1) { cout << "? "; cin >> loanValue >> interest >> numYears; double numMonths = 12*numYears; if(loanValue <= 0) break; double sum = 0; double factor = 1; int n; for(n=0; n