If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Re: Square Roots and Totals Table c++

That's not a specific question addressing a problem you're having. Your question should be along the lines of "Here's my code. It's doing x when I want it to do y, and I'm not sure how to make it do z."

When you have \n in a string this causes a new line to be started in the output. So the \n\n after x^2 causes 2 new lines to be output which is probably not what you want. You also want the output in the same order as your heading which is x sqrt(x) x^2 and x^3 but you are outputting in the order x^3 x sqrt(x) x^2. Cout outputs in the order that it is used.

Re: Square Roots and Totals Table c++

This is the way it should be?... I was also wondering what way I would go about adding a total row along the bottom?

Go back and change your loop to use integers, not doubles.

The reason is that floating point arithmetic is not exact. Right now, you're only getting away with it because you're adding 1 to the value. If you were adding 0.1 or some other fractional element, the loop will execute an indefinite number of times due to floating point rounding errors.

* The Perfect Platform for Game Developers: Android
Developing rich, high performance Android games from the ground up is a daunting task. Intel has provided Android developers with a number of tools that can be leveraged by Android game developers.

* The Best Reasons to Target Windows 8
Learn some of the best reasons why you should seriously consider bringing your Android mobile development expertise to bear on the Windows 8 platform.