how to use a for loop?

Hello I am glad to be a member of this forum.
I have a little problem starting this problem.

"Develop a compound interest program to repeat its steps from interest rate of 5 percent, 6 percent, 7 percent, 8 percent, 8 percent, and 10 percent. Use a for loop to vary the interest rate. "

If anyone could help me I would appreciate it.
Thanks
Did you mean 5, 6, 7, 8, NINE, 10? ;)

Here is how you use a for loop:
for(pre-loop setup; loop condition; loop action)

Most commonly you will see this:
for(unsigned long i = 0; i < some_value; ++i)
Which loops through every value between [0, some_value)

This is an infinite loop:
for(;;)
As you can see all statements are optional.

Check here: http://www.cplusplus.com/doc/tutorial/control/#for
Last edited on
is that the whole problem?
1
2
3
4
for (int i=5; i < 11; i++)
{
    cout << "Your equation here, using i as the interest rate" << endl;
}
Yes it's 5,6,7,9,10..
Thank you!
You mean 5, 6, 7, EIGHT, 9 10? ;)
@L B

Haha, that made me chuckle. #define PEDANTIC
Topic archived. No new replies allowed.