# i feel that i lost my mind

 Mahmoud Abdel Ghani · September 5, 2014  Raising a number n to a power p is the same as multiplying n by itself p times. Write a function called power() that takes a double value for n and an int value for p, and returns the result as a double value. Use a default argument of 2 for p, so that if this argument is omitted, the number n will be squared. Write a main() function that gets val- ues from the user to test this function. .....i want to understand what he want?????i lost my mind

## Replies

 Franz Schmidt · September 5, 2014 He wants you to make a function which can calculate powere.g.: n=2 p=4 => n^p = 2^4 = 2*2*2*2 =16and this you have to make in a function with paramters (n as double parameter and p as int parameter)the returnvalue has to be the result of the calculation in double format.and if p value gets obmitted you should make a default value of 2 so he can calculate n^2 Mahmoud Abdel Ghani · September 5, 2014 i begin to hate programming Mahmoud Abdel Ghani · September 5, 2014 object oriented programming in c++ forth edition ..im trying to finish it and solve the exercises but i feel that my mind stop evertytime while i solve the exercises
• 1

## C++

129,841 followers