|
| |||||||||
| Tags: cpp, functions, header files, library, sqrt, valarray |
![]() |
| | Thread Tools | Search this Thread |
|
#1
| |||
| |||
| 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!!!! |
|
#2
| |||
| |||
| 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. |
|
#3
| ||||
| ||||
| 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;
} Code: The initial valarray is: ( 0 1 4 9 16 ). The square root of the initial valarray is: ( 0 1 2 3 4 ). |
|
#4
| ||||
| ||||
| 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); |
|
#5
| ||||
| ||||
| 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;
}
} |
![]() |
|
| Thread Tools | Search this Thread |
| |
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 |