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/

29 Comments

King Worldwide

February 22, 2020

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

Reply

BUZZ Roblox

February 22, 2020

thx so much

Reply

Ryan Mya

February 22, 2020

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

Reply

Dark Night

February 22, 2020

How to do the cube root????

Reply

Lorenzo Barella

February 22, 2020

What editor are you using?

Reply

nour elmalky

February 22, 2020

thanks

Reply

ssKiller 7

February 22, 2020

grazie

Reply

taha satti

February 22, 2020

thanks bro

Reply

uzeir dalip

February 22, 2020

thanks

Reply

Tim Rubin Halcomb

February 22, 2020

Can you put i++ for square?

Reply

Abdallah Al Ja3ari

February 22, 2020

Can someone tell me what program he's using ?

Reply

srihari vaila

February 22, 2020

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

Reply

Pech Panha

February 22, 2020

I want say thanks you very much.

Reply

Austine Declan

February 22, 2020

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

Reply

what is life

February 22, 2020

Thanks alot man, that helped alot 🙂

Reply

Potato

February 22, 2020

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

Reply

Veritas Gaming

February 22, 2020

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

Reply

Ahmed Shaikh

February 22, 2020

Thanks!

Reply

Smax TM

February 22, 2020

thank you very much

Reply

Murtaza Iqbal

February 22, 2020

Thank you man it erally helped me in my work

Reply

Veejj

February 22, 2020

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?

Reply

BONJA

February 22, 2020

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

Reply

Micah Houghton

February 22, 2020

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

Reply

Krabby Patty

February 22, 2020

thank you

Reply

Bijan Sanchez

February 22, 2020

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

Reply

Engineer4Free

February 22, 2020

glad to hear it!

Reply

Alex Ranos

February 22, 2020

many thanks u helped me a lot

Reply

Engineer4Free

February 22, 2020

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

Reply

JMac80one

February 22, 2020

Great, thanks for the info

Reply

Leave a Reply