Another Problem

#include <iostream>
#include <cstdio>
#include <cmath>


using namespace std;

int main ()
{
double dollars, amount, interest, formula;
int days, rate;
int b=100;
bool notValid;
int a=1;

do{
notValid=false;
cout << "\nInitial amount in dollars? " ;
cin >> dollars;
if (dollars <10 || dollars >10000)
{
cout << "\nDollar amount should be between 10 and 10000";
notValid=true;
}
} while (notValid);

do{
notValid=false;
cout << "\nInterest rate in percentage? " ;
cin >> rate;
if (rate <1 || rate >22)
{
cout << "\nInterest rate should be between 1 and 22";
notValid=true;
}
} while (notValid);

do{
notValid=false;
cout << "\nNumber of days? " ;
cin >> days;
if (days<2 || days >30)
{
cout << "\nNumber of days should be between 2 and 30";
notValid=true;
}
} while (notValid);

{
cout << "\n\nDay Earned Interest Balance";
cout << "\n-----------------------------------\n";


for(a==1; a <= days; )
{
formula=(rate/b);
interest=formula*dollars;
amount=dollars + interest;

cout << a;
cout << " ";
cout << interest;
cout << " ";
cout << amount;
cout << " ";
cout <<"\n\n";
a++; }
system("pause");

}
return 0;
}


How come I can't get interest in this program, guys?
In your last "for" loop, you have a == 1, not a = 1. Also, your a++ should go in the "for" loop signature thusly:

for( a = 1; a <= days; a++ )

Are you seeing errors? Is anything displaying?
closed account (z05DSL3A)
rate and b are both int, so formula will be zero for all rates bellow 100.
@Grey Wolf: got it

Thanks
Topic archived. No new replies allowed.