http://prntscr.com/dwer81 Could someone guide me on how to write this program? I'm not even remotely sure on what to do. Note: I'm limited in what I can use. I can't use strings. I'm stuck using if else, while, for, and switch.
Ugh, okay. I get the gist of it, but I'm still having trouble figuring out how I would set it up. Like let's say for example, the process loops until the current estimate - the previous estimate < .05, how would I be able to make it so it'll take current value and the previous one and subtract it like that?
how would I be able to make it so it'll take current value and the previous one and subtract it like that?
Just before calculating the next value, store the current one in another temporary variable. After getting the next value, subtract it from the saved value.
Also, you need to use the absolute (unsigned) value of the resulting difference. You could use the std::abs() function. Or, since you may be expected to write everything yourself, you could test the value, and if it is less than zero, use diff = -diff; to flip the sign.