Function and Procedure: Without Exponential Operator?
Author |
Message |
PrinceCooper
![](http://compsci.ca/v3/uploads/user_avatars/7487862614df61f78777fd.jpg)
|
Posted: Mon Jun 13, 2011 9:52 am Post subject: Function and Procedure: Without Exponential Operator? |
|
|
Problem:
The program needs to use a function named Power that raises its first parameter (a real value) to the power indicated by the second parameter (an integer), without using the exponential operator (**). The function will return the result.
Issue:
I can achieve this WITH the use of the exponential operator, but completely confused without it.
I would appreciate it if someone could help me with this problem and explain how they came to their conclusion so I can avoid this issue in the future if at all possible.
Bonus:
Change the function into a procedure that returns the result of power operation into a third parameter.
4.0.4c[/b] |
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
Tony
![](http://wiki.compsci.ca/images/f/f4/OniTony.gif)
|
Posted: Mon Jun 13, 2011 10:00 am Post subject: RE:Function and Procedure: Without Exponential Operator? |
|
|
The idea is to implement the exponential operator as a Power function, so you should start with the definition -- how is the ** operator defined (what exactly does it do)? |
Tony's programming blog. DWITE - a programming contest. |
|
|
|
![](images/spacer.gif) |
|
|