Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 09-03-2010
Member
 
Join Date: Dec 2009
Posts: 26
What is the sqrt() : C++

I am working in the XYZ company as software developer. We can use the C++ language for developing the software. Hence, I can not know about the sqrt() function of the C++ language. So, I would like to know about the sqrt() function of the C++ language. I also would like to know about what is the use of the sqrt() function of the C++ language. Can anyone has the solution for me then reply!!!!
Reply With Quote
  #2  
Old 09-03-2010
Member
 
Join Date: May 2008
Posts: 2,008
The sqrt() function : C++

The sqrt() function of the C++ language can be used to calculate the square root of an elements of the valarray. The sqrt() function can returns an object of the valarray that can be consisting of the square root of all an elements of z. The sqrt() function can overloads the cmath's sqrt function. The sqrt() function can be a member function of the valarray.
Reply With Quote
  #3  
Old 09-03-2010
Member
 
Join Date: Apr 2008
Posts: 2,001
The sqrt() : C++

The following program could states you that how you can use the sort() function in the C++ language programming while using the sort() function in the programming as shown below :
Code:
#include <valarray>
#include <iostream>
#include <cmath>
int main( )
{
   using namespace std;
   int g;
   valarray<double> w1 ( 6 );
   for ( g = 0 ; g < 5 ; g++ )
      w1 [ g ] = g * g;
   cout << "The initial valarray is: ( ";
      for ( g = 0 ; g < 5 ; g++ )
         cout << w1 [ g ] << " ";
   cout << ")." << endl;
   valarray<double> w2 = sqrt ( w1 );
   cout << "The square root of the initial valarray is: ( ";
      for ( g = 0 ; g < 5 ; g++ )
         cout << w2 [ g ] << " ";
   cout << ")." << endl;
}
Output
Code:
The initial valarray is: ( 0 1 4 9 16 ).
The square root of the initial valarray is: ( 0 1 2 3 4 ).
Reply With Quote
  #4  
Old 09-03-2010
Member
 
Join Date: May 2008
Posts: 2,293
What is the sqrt() : C++

The sqrt() function can computes the square root of an elements of the valarray. The sqrt() function can displays an object of the valarray that can be containing the square root of all the elements of c. The sqrt() function can overloads the cmath's sqrt function. The following can be the general form of the sqrt() function of the C++ :
Code:
template<class W> valarray<W> sqrt (const valarray<W>& c);
Reply With Quote
  #5  
Old 09-03-2010
Member
 
Join Date: Nov 2005
Posts: 1,323
Re: What is the sqrt() : C++

The following can be the parameter of the sqrt() function of the C++ language :
1. c : This parameter of the sqrt() function of the C++ language can contains valarray consisting of an elements of a type for that the unary function sqrt can be defined. The sqrt () function can returns the value of a valarray object along with the square roots of an elements of c. For example :
Code:
#include <cmath>
#include <iostream>
using namespace std;
int main()
{
    for(int y = 1; y < 11; y++)
    {
        cout<<"Square root of: "<<y<<" is "<<sqrt(y)<<endl;
    }
}
The above an example can produce the sqare root of given numbers that is 1 to 10.
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , , , , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "What is the sqrt() : C++"
Thread Thread Starter Forum Replies Last Post
C : Implementation of sin(),pow(),sqrt() Adolfa Software Development 4 30-01-2010 12:41 PM


All times are GMT +5.5. The time now is 04:59 PM.