Check out for more free engineering tutorials and math lessons!

C++ Programming Tutorial: Square root and power functions

Please support my work:

PATREON |

Every dollar is seriously appreciated and enables me to continue making more tutorials

Nguồn:https://madisonrep.org/

Define a class to find the third root of your B[15].

thx so much

thx very helpful, never thought that it only required a new header

How to do the cube root????

What editor are you using?

thanks

grazie

thanks bro

thanks

Can you put i++ for square?

Can someone tell me what program he's using ?

Hello mine is not doing square root for numbers which are declared in variables

I want say thanks you very much.

I had no idea I had to include cmath. That's what was missing for me. First year computer science student here.

Thanks alot man, that helped alot 🙂

What text editor are you using? I'm just using the C++ software because I can't seem to run C++ on Brackets

what IDE do you recommend for C++ coding on a mac? I am using Xcode but tbh it sucks :/

Thanks!

thank you very much

Thank you man it erally helped me in my work

But what if that number that you are square rooting is a variable, regardless if its an integer or not, and you want to continue to use the square rooted number with more addition before showing it on screen? I am trying to make a C++ program for finding the Surface Area of a Cone and I have to continue to use the number after it is square rooted. Any help?

I have got a problem, when I try to calculate a square root, if the result contains decimals, It shows me the closest number, and not the result with decimals

what if the input for square root is a negative number? I keep getting nan

thank you

what if the base is negative and the power is 0.5???

glad to hear it!

many thanks u helped me a lot

YouTube wont let me write proper code in the comments, so here is what you can write (minus the semicolons)

double x

cout << "Please enter a number: "

cin << x

cout << "The square root of " << x << " is " << sqrt(x) << endl

the output will be:

Please enter a number: 9

The square root of 9 is 3

Great, thanks for the info