Talk:C++/Simple Math

From Wikiversity
Jump to navigation Jump to search

Just an FYI the last example has a typo:

"pow(myValue,myPowner); // myValue is the base and myPower is the exponent"

                 ^ the n should be removed or             ^ the n should be added

This is a great article, and I am enjoying reading it.




Could it be that the the variable my_result in the third line of the code

float myValue=25, myResult;
myResult = sqrt(myValue);       // Squareroot the variable myValue, and store it into variable myResult
myResult = pow(my_result,2.00);  // Square the variable myResult, and then store it back into myResult

should be renamed in myResult?

AND I think the float 2.00 should be replaced by an int 2. At least my Dev-C++ (version can't handle a float as the second parameter of the pwr() function.

BTW, nice tutorial so far.


Start a discussion about C++/Simple Math

Start a discussion