Happy Codings - Programming Code Examples
Html Css Web Design Sample Codes CPlusPlus Programming Sample Codes JavaScript Programming Sample Codes C Programming Sample Codes CSharp Programming Sample Codes Java Programming Sample Codes Php Programming Sample Codes Visual Basic Programming Sample Codes

C++ Programming Code Examples

Learn C++ Language

Math Library pow() Function in C++ Programming Language

Math Library pow() Function in C++
Raise to power. The pow() function returns the result of the first argument raised to the power of the second argument. This function is defined in the cmath header file. pow() function is a library function of cmath header, it is used to find the raise to the power, it accepts two arguments and returns the first argument to the power of the second argument. power = baseexponent
Syntax for Math pow() Function in C++
#include<cmath> double pow (double base , double exponent); float pow (float base , float exponent); long double pow (long double base, long double exponent); double pow (Type1 base , Type2 exponent); // additional overloads
Base value
Exponent value Additional overloads are provided in this header (<cmath>) for other combinations of arithmetic types (Type1 and Type2): These overloads effectively cast its arguments to double before calculations, except if at least one of the arguments is of type long double (in which case both are casted to long double instead). This function is also overloaded in <complex> and <valarray>. Function returns the result of raising base to the power exponent. If the base is finite negative and the exponent is finite but not an integer value, it causes a domain error. If both base and exponent are zero, it may also cause a domain error on certain implementations. If base is zero and exponent is negative, it may cause a domain error or a pole error (or none, depending on the library implementation). The function may also cause a range error if the result is too great or too small to be represented by a value of the return type.
/* get base raised to the power exponent by pow() function */ // CPP program code example to illustrate power function #include <bits/stdc++.h> using namespace std; int main() { double x = 6.1, y = 4.8; // Storing the answer in result. double result = pow(x, y); // printing the result upto 2 // decimal place cout << fixed << setprecision(2) << result << endl; return 0; }

C++ program encodes any message using the technique of 'One time' pad cipher technique. Input is not Case Sensitive and works only for all characters. 'White Spaces' are not ignored

To get the IP address of your computer in c++ programming, use the function system() and place the command 'ipconfig' after providing the full path of 'System32' i.e., C:\\Windows\\