This is my third program was just wondering if anybody had any better ideas???? seems to work for now...... was just wondering hmm
Code:#include <iostream> using namespace std; int main() /*function main*/ { float bal = 0; int month = 0; float dep = 0; float wit = 0; float interest = 0; float rate = 0; float totalinterest =0; float mi = 0; float twit =0; float tdep = 0; cout <<"Please enter the your balance $: "; cin >> bal; cout <<"Please enter the your interest rate $: "; cin >> rate; cout <<"How many months has the account been opened? :"; cin >> month; rate = rate/12; while (month >= 1)////start loop { cout <<"Please enter total deposits per month $: "; cin >> dep; if (dep < 0) { cout << "Error start over"; break; } cout <<"Please enter total withdrawals per month $: "; cin >> wit; if (wit < 0) { cout << "Error start over"; break; } twit += wit; tdep += dep; bal += dep; bal -= wit; mi = (rate/100) * bal; totalinterest += mi; bal += mi; month--; if (bal < 0) { cout <<" Account Closed see the Bank Manager"; break; } } cout.setf(ios::showpoint); cout.setf(ios::fixed); cout.precision(2); cout <<'\n'; cout << "The balance is " << bal << endl; //print output cout << "The total deposits are: " << tdep << endl; cout << "The total withdrawals are: " << twit << endl; cout << "The total interest earned is : " << totalinterest << endl; return 0; }
thanks for any input



LinkBack URL
About LinkBacks


