i feel that i lost my mind 
0 
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

Post a Reply 
Replies 
Oldest Newest Rating 
+1 
Franz Schmidt
· September 5, 2014
He wants you to make a function which can calculate power
e.g.: n=2 p=4 => n^p = 2^4 = 2*2*2*2 =16 and 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 
1 
Mahmoud Abdel Ghani
· September 5, 2014
i begin to hate programming

+1 
Mathias Frits Rørvik
· September 5, 2014
Which book are you reading?

0 
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

+2 
Mathias Frits Rørvik
· September 7, 2014
Seems like you are missing some core concepts. Have you tried going a few chapters back and try to do the earlier exercises? Or you could try another book, I suggest C++ Primer by Josée Lajoie and Stanley B. Lippman.
Anyway, one possible solution would be this. 
 1