finding the square root of a number

This is a discussion on finding the square root of a number within the C++ Programming forums, part of the General Programming Boards category; is there an easy (or even not easy) way to find the square root of a number in c++? like, ...

  1. #1
    Geo Geo Geo-Fry
    Join Date
    Feb 2003
    Posts
    116

    finding the square root of a number

    is there an easy (or even not easy) way to find the square root of a number in c++? like, well, actually i have no idea how you would do it.... is it even possible?
    "You can lead a man to Congress, but you can't make him think."
    "The Grand Old Duke of York
    -He had ten thousand men.
    -His case comes up next week."
    "Roses are red, violets are blue, I'm schizophrenic, and so am I."
    "A computer once beat me at chess, but it was no match for me at kick boxing."
    "More and more of our imports are coming from overseas."
    --George W. Bush
    "If it weren't for electricity, we'd all be wacthing TV by candlelight."
    --George W. Bush

  2. #2
    Registered User
    Join Date
    Nov 2002
    Posts
    1,109
    look up sqrt() in cmath.

  3. #3
    RoD
    RoD is offline
    Redundantly Redundant RoD's Avatar
    Join Date
    Sep 2002
    Location
    Missouri
    Posts
    6,331
    Code:
    #include <iostream>
    #include <ctype.h>
    #include <math.h>
    
    using namespace std;
    
    int main()
    {
    	double find_sqrt;
    
    	cout << "Enter a double: ";
    	cin >> find_sqrt;
    
    	cout << sqrt(find_sqrt) << endl;
    
    	return 0;
    }

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. code to find th square root of a number
    By CODY21 in forum C++ Programming
    Replies: 34
    Last Post: 10-29-2010, 10:27 AM
  2. square root bisection?? help
    By gagne73 in forum C++ Programming
    Replies: 4
    Last Post: 10-19-2007, 03:39 AM
  3. Checking for integer after square root
    By Boomba in forum C++ Programming
    Replies: 13
    Last Post: 01-04-2006, 10:22 PM
  4. The third root of a number
    By dwks in forum C Programming
    Replies: 5
    Last Post: 08-25-2005, 12:43 PM
  5. Homework help
    By Jigsaw in forum C++ Programming
    Replies: 2
    Last Post: 03-06-2002, 05:56 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21