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
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
-1 Mahmoud Abdel Ghani · September 5, 2014
i begin to hate programming :(
  • 1

C++

124,358 followers
About

Used in many types of software including music players, video games, and many large scale applications.

Links
Moderators
Bucky Roberts Administrator