Some other useful functions

In this section I just wanted to deal with a few functions that you might find useful while programming in C++. I'll mention in brief the use of the function and the required header file.

If you're making use of mathematical formulas you may need to find the powers of some numbers (for example : 3 to the power of 5 or something). The function to be used if pow( )
Syntax :     pow (base, exponent);
Header file needed :
#include<cmath>     // if your compiler is an old one then type #include<math.h>
The function will return the answer, base raised to the exponent power.

I mentioned earlier that using cin you cannot get an input of spaces (i.e. when the compiler encounters a space character it will stop the input with that. Refer Q & A section for the details).
You can use the gets function to solve the problem

Syntax :     gets (char array name where you want to store the string);
Header file needed :
#include<cstdio>      // if your compiler is an old one then type #include<stdio.h>
Characters are read till a new line is received.

More functions will be added soon... Email : ssbell2000@yahoo.com in case you have any doubts or if you would like to add some function in this page.
Go back to the Contents Page 2.