I can't seem to figure this out, though it should be pretty simple. Here are my instructions:

Compound interest

Compound.cpp

Write a program that calculates compound interest. The program should ask the user for the starting dollar amount and the daily increase (as a percentage), and the number of days. A loop should then be used to display the day, the amount of interest earned on that day and the account balance on that day. The program should also display the total interest earned. Output should be as follow

Initial amount in dollars? 100

Interest rate in percentage? 10

Number of days? 3

Day Earned interest Balance

-----------------------------------------------

1 $10 $110.00

2 $11 $121.00

3 $12.10 $133.10

Total Interest earned: $33.10

Validation:

Dollar amount should be between 10 and 10000

Interest rate should be between 1 and 22

Number of days should be between 2 and 30

The output should be formatted and aligned according to the above.

Here is my code:

Code:

#include <cstdio>
#include <math.h>
#include <iostream>
using namespace std;
int main ()
{
double dollars, amount, interest, power, formularate;
int days, rate;
bool notValid;
int a=1;
do{
notValid=false; //Validation for amount
cout << "\nPlease enter dollar starting amount?" ;
cin >> dollars;
if (dollars <10 || dollars >10000)
{
cout << "\nYou have entered invalid data";
notValid=true;
}
} while (notValid);
do{
notValid=false; //Validation for rate
cout << "\nWhat is the daily increase (as a percentage)?" ;
cin >> rate;
if (rate <1 || rate >22)
{
cout << "\nYou have entered invalid data";
notValid=true;
}
} while (notValid);
do{
notValid=false; //Validation for days
cout << "\nEnter the number of days:" ;
cin >> days;
if (days<2 || days >30)
{
cout << "\nYou have entered invalid data";
notValid=true;
}
} while (notValid);
{
cout << "\n\nDay Earned Interest Balance";
cout << "\n-----------------------------------\n";
for(a==1; a <= days; ) //Loop for display
{
formularate=(rate/100);
amount=dollars*pow(1+(formularate/365),(a));
interest=amount-dollars;
cout << a;
cout << " ";
cout << interest;
cout << " ";
cout << amount;
cout << " ";
cout <<"\n\n";
a++; }
system("pause");
}
}

Why is my interest 0?