[SOLVED] I Need Help With This C++ Problem
Students will calculate the balance on a bank credit card that increases at a rate of 2% every month. The initial balance starts at $50. Use a while loop to repeat the increase until the balance reaches $100 or more. By implementing a counter; your program should count the number of months it takes to reach $100 and report it at the end of your program. #include <iostream> using namespace std; int main(){ int accumulate = 100; int balance; double rate = 0.02; int time = 0; double totalbalance = 50; cout.setf(ios::fixed); cout.setf(ios::showpoint); cout.precision(2); while (balance<accumulate) { balance += balance + (balance*2/100); balance -= 50; time += 1; } cout << "This program tells you how long it takes to accumulate a debt of
quot;<< accumulate << ", starting with" << endl; cout << "an initial balance of $50 owed." << endl; cout << "The interest rate is 2%" <<" per month."<<endl; cout << "After " << time << " months," << endl; cout << "your balance due will be quot; << balance << endl; return 0; }