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: 28
Use of the tan() function : C++

I am the student of the MSC-IT. I could had the well knowledge of the C++ programming language. But I can not know much more about the built-in functions of C++ programming language. So, I want to know about the tan() function of the C++ language. I also want to know about how can I use the tan() function in the C++ programming language. Thus, Can anyone has the proper answer on the tan() function in the C++ language. Reply Me!!!
Reply With Quote
  #2  
Old 09-03-2010
Member
 
Join Date: Oct 2005
Posts: 2,389
The tan() function : C++

The tan() function of the C++ language can calculates the tangent of an elements of the valarray. The tan() function can returns an object of the valarray that can be consisting of the tangents of all an elements of y. The following can be the syntax of the tan() function of the C++ language as follows :
Code:
template<class W> valarray<W> tan (const valarray<W>& y);
Reply With Quote
  #3  
Old 09-03-2010
Member
 
Join Date: May 2008
Posts: 2,383
Use of the tan() function : C++

A valarray whose elements can be equal to the tangen elements of the input valarray. The following can be the parameters of the tan() function in the C++ programming language :
1. y : This parameter of the tan() function can be used to contains a valarray that can be consisting of an elements of a type for that the unary function tan can be defined. Every an element's value can represents an angle that can be an expressed in radians.
__________________
The FIFA Manager 2009 PC Game
Reply With Quote
  #4  
Old 09-03-2010
Member
 
Join Date: Feb 2008
Posts: 1,848
Re: Use of the tan() function : C++

The following program could states you that how you can use the tan() function in the C++ language coding while using the tan() function in the coding as shown :
Code:
using namespace std;
#include <cmath>
#include <valarray>
#include <iostream>
int main ()
{
  double wl[] = {0.35, 1.22, 3.4};
  wlarray<double> e (wl,3);
  wlarray<double> br = tan (e);
  cout << "e: ";
  eor (size_t k=0; k<e.size(); ++k)
	  cout << e[k] << ' ';
  cout << endl;
  cout << "br: ";
  eor (size_t k=0; k<br.size(); ++k)
	  cout << br[k] << ' ';
  cout << endl;
  return 0;
}
Output:
Code:
e: 0.35 1.22 3.4
br: 0.335376 0.839654 0.997775
Reply With Quote
  #5  
Old 09-03-2010
Member
 
Join Date: Jan 2008
Posts: 1,515
Re: Use of the tan() function : C++

The tan() function can returns the tangent of an argument ag, where an ag can be given in radians. If ag can be an infinite then tan() function can returns NAN and can raise a floating-point an exception. C++ can also provides the following overloaded forms as :
Code:
 #include <cmath>
    float tan( float ag ); 
    long double tan( long double ag );
Reply With Quote
  #6  
Old 09-03-2010
Member
 
Join Date: Apr 2008
Posts: 1,948
tan() function : C++

I can suggest you that to carefully go through the following code of lines that can demonstrates you how to use the tan() function in the C++ programming as follows :
Code:
#include <valarray>
#include <iostream>
#include <iomanip>
int main( )
{
   using namespace std;
   double pi = 3.14159265359;
   int j;
   valarray<double> wa1 ( 9 );
   for ( j = 0 ; j < 9 ; j++ ) 
      wa1 [ j ] =  ( pi/2 ) * ( 0.25 * j - 1 );
   valarray<double> wa2 ( 9 );
   cout << "The initial valarray is:\n";
   for ( j = 0 ; j < 9 ; j++ )
      cout << setw( 10 ) << wa1 [ j ]
      << "     radians, which is   "
      << setw( 5 ) << ( 180/pi ) * wa1 [ j ]
      << "   degrees" << endl;
   cout << endl;
   wa2 = tan ( wa1 );
   cout << "The tangent of the initial valarray is:\n ";
   for ( j = 0 ; j < 9 ; j++ )
      cout << wa2 [ j ] << endl;
}
Output
Code:
The initial valarray is:
   -1.5708     radians, which is     -90   degrees
   -1.1781     radians, which is   -67.5   degrees
 -0.785398     radians, which is     -45   degrees
 -0.392699     radians, which is   -22.5   degrees
         0     radians, which is       0   degrees
  0.392699     radians, which is    22.5   degrees
  0.785398     radians, which is      45   degrees
    1.1781     radians, which is    67.5   degrees
    1.5708     radians, which is      90   degrees

The tangent of the initial valarray is:
 9.6701e+012
-2.41421
-1
-0.414214
0
0.414214
1
2.41421
-9.6701e+012
Reply With Quote
Reply

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



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "Use of the tan() function : C++"
Thread Thread Starter Forum Replies Last Post
c++ equivalent function to the c-function 'sprintf Dilbert Software Development 6 13-12-2011 04:03 PM
c# function equivalent to gettime function in javascript Omaar Software Development 4 10-03-2010 10:44 PM
How to pass function with parameters to another function in PHP? Linoo Software Development 5 27-02-2010 07:52 PM
How does abstract function differs from virtual function? Maddox G Software Development 5 29-01-2010 11:32 AM
Function keys don't function under windows XP GunFighter Hardware Peripherals 3 08-04-2009 11:07 PM


All times are GMT +5.5. The time now is 06:19 PM.