J
jason1551
I'm working on a program that will compute interest on a savings
account. The interest is compounded monthly for 30 years, and a
desposit is made on the account at the beginning of each year. My
problem is that my C++ skills are pretty limited, and this needs to be
done within a few days. I've figured out a basic structure, but need
help understanding what is and what is not working. Here's what I've
got so far:
#include <iostream>
using namespace std;
int main()
{
double I, P, R;
int i, x;
P=2000.00;
R=00.06;
{
for (i=0; i<30; i++)
{
for (x=0; x<12; x++)
I=P+P*R;
cout<< i << " "<< I<<endl;
i++2000.00;
}
}
return 0;
}
I know that I have to use a nested loop at some point, but I'm not sure
if I set it up correctly. I also realize that this is pretty barebones
in terms of actual programming, as I'm not an expert and trying to keep
this as simple for myself as possible. Any advice would be extremely
helpful and appreciated.
account. The interest is compounded monthly for 30 years, and a
desposit is made on the account at the beginning of each year. My
problem is that my C++ skills are pretty limited, and this needs to be
done within a few days. I've figured out a basic structure, but need
help understanding what is and what is not working. Here's what I've
got so far:
#include <iostream>
using namespace std;
int main()
{
double I, P, R;
int i, x;
P=2000.00;
R=00.06;
{
for (i=0; i<30; i++)
{
for (x=0; x<12; x++)
I=P+P*R;
cout<< i << " "<< I<<endl;
i++2000.00;
}
}
return 0;
}
I know that I have to use a nested loop at some point, but I'm not sure
if I set it up correctly. I also realize that this is pretty barebones
in terms of actual programming, as I'm not an expert and trying to keep
this as simple for myself as possible. Any advice would be extremely
helpful and appreciated.