So, I've written part of this program, basically just gathering all the info so far. But, I need the program to now calculate, and calculate on an interval. How do I do this with a nested loop? Am I on the right track with the for loop?
In other words the code contains a "for" loop and then a "while" loop. By the time the "while" loop executes, loopVol will be greater than "final" because if it wasn't, then the "for" loop would still be executing.
A "for" loop is really just shorthand for a "while" loop. Any "for" loop like this:
1 2 3
for (a; b; c) {
code;
}
is equivalent to this:
1 2 3 4 5 6 7
{
a;
while (b) {
code;
c;
}
}
Hope this helps. If you're still having trouble then explain what you're trying to compute.
Wow, thanks. That helped a lot! Now, I'm just having trouble having the results print in a tabular form. They're printing in a strange space array. But, I'm not sure how to do either of the following which I think would fix the issue:
(a) use setw in conjunction with printf
(b) change to cout to use setw, but still retrieve previous answers