STANDARD FUNCTIONS IN C++, A PARTIAL LIST
Function Name
|
Description |
Syntax |
Returning Value
|
abs |
Returns the absolute value of an integer. |
#include <math.h> int abs (int x); |
abs returns an integer in the range of 0 to 32767, with the exception of -32768 returned as -32768 |
clrscr |
Clears the text window. |
#include <constrea.h> void clrscr (void); |
clrscr clears the current text window and places the cursor in the upper left-hand corner (position 1,1). |
fabs |
Returns the absolute value of a double float. |
#include <math.h> double fabs (double x); |
|
pow |
Calculates x to the power y. |
#include <math.h> double pow (double x, double y); |
On success, pow returns the value calculated, xy. |
random |
Random number generator. |
#include <stdlib.h> int random (int num); |
random returns a random number between 0 and (num-1). Both num and the random number returned are integers. |
randomize |
Initializes random number generator. |
#include <time.h> #include <stdlib.h> void randomize (void); |
randomize initializes the random number generator with a random value. Because randomize calls the time function, you must also include <time.h>. |
sqrt |
Calculates the positive square root of the input value. |
#include <math.h> double sqrt (double x); |
|
sin |
Returns the sin (x), x in radians |
#include <math.h> double sin (double x); |
|
cos |
Returns the cos (x), x in radians |
#include <math.h> double cos (double x); |
|
tan |
Returns the tan (x), x in radians |
#include <math.h> double tan (double x); |
|
asin |
Returns inverse sin (x), returned value in radians |
#include <math.h> double asin (double x); |
|
acos |
Returns inverse cos (x), returned value in radians |
#include <math.h> double acos (double x); |
|
atan |
Returns inverse tan (x), returned value in radians |
#include <math.h> double atan (double x); |
|
exp |
Returns answer of ex |
#include <math.h> double exp(double x); |
|
log |
Returns natural log of x |
#include <math.h> double log (double x); |
|
log10 |
Returns base-10 log of x |
#include <math.h> double log10 (double x); |
|