can't find where the error occurs using debugger? any help plz~~

//this program computes how much money will
//accumulate after so many years of investing

#include <iostream>
using namespace std;

float Balance = 0.0;
float Interest;
float YearlyCont;
int NumYears;

//this function computes one year of investment
float newBalance(float balance);

int main () {
    cout << "How much money will you deposit" << "each year?" << endl;
    cin >> YearlyCont;

    cout << "What interest rate will you get" <<"(enter 5% as .05)?" << endl;
    cin >> Interest;

    cout << "How many years will you invest?" << endl;
    cin >> NumYears;

    for (int i = 1; i <= NumYears; i++);
    Balance = newBalance (Balance);

    cout << "Money at end of investment: " << Balance << endl;

    return 0;

float newBalance (float balance) {

//add in this year's deposit
balance = balance + YearlyCont;

//add in this year's interest
balance = (Interest + 1.0f) * Balance;

return balance;
12 Years
Discussion Span
Last Post by jack223
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.