for some reason I cannot use sqrt on an int??

Hey guys, cool site, glad to be a member! I have a new C++ book that I'm learning from and I can't figure out what I'm missing. Here is the function straight out of "C++ without Fear" second edition by Brian Overland.

It will not let me pass sqrt an integer. It's telling me that it has to be double, float, or something like that. I changed root_n to n/2 and it runs fine... But this isn't what I need!! HELP!!!
Thanks guys and awesome to be here. Court SC,USA

Gotcha, thank you. I looked that up and it worked. However, I am surprised that that is written like that in this book. I tried to be careful about what book I selected to learn from and I guess I struck out! That function was from the text Verbatim! The book was copy write 2010... Did the previous version compiler select the type for you or is this guy a quack? Confused...

Dude.....I'm taking this back to Books-a-Million.... It isn't just one time. He does that prime finder over and over to introduce while, for, and so on... EVERY TIME it's the same thing! I mean, I'm not an expert (yet) but a lot of you guys are and I think most would agree that early on is the most important time to avoid bad habits and careless mistakes. Luckily, it's tough to make me give up; but, what about all the people that ran into this and decided that this stuff is just too difficult?? Ya know?

@Court
I looked that up and it worked. However, I am surprised that that is written like that in this book.

It is implementation-defined whether overload C functions will be placed in the global namespace or will not. So the same code can be translated with GCC 4.7.1 and will not be translated with MS VC++ 2010.

It really is implementation specific, and the compiler will spit an error if it doesn't like what you are doing. As long as you can understand the errors, you shouldn't have a problem. It's a lot better than not understanding why your program is giving the wrong output.

As long as you have a different compiler, or even different version of the same compiler than the author, every book is going to have small things like this. Just ask whenever you come across something new that you don't understand.