Your pow function is incorrect. Your first task is to create this function
//returns base^exp in mathematical sense
//example power(2,2) => 4 , power(2,8) => 256
//note works only for exp > 0
int power(const int base,const int exp);
then you can use that power function in your for loop but depending on the sign of the exponent, you can either display the result or 1/result
firstPerson
Senior Poster
3,923 posts since Dec 2008
Reputation Points: 841
Solved Threads: 608
CANNOT USE THE POW() FUNCTION.
Why are you shouting at us? Do you really think we can't understand you unless you shout?ANY HELP APPRECIATED!
What again? Why would you need to yell at us again!?!!?Do not write in all uppercase or use "leet", "txt" or "chatroom" speak
Calm down. We aren't that hard of reading...
WaltP
Posting Sage w/ dash of thyme
10,506 posts since May 2006
Reputation Points: 3,348
Solved Threads: 944
what do you have now? Post it.
firstPerson
Senior Poster
3,923 posts since Dec 2008
Reputation Points: 841
Solved Threads: 608
Why does your ExpPow function ignore the "count" argument? Start there, and think about what it really needs to compute.
Then think about your negexp function: how does the result of a negative exponent compare to the corresponding positive exponent? Can you make use of that by having one function call the other?
All the other looping in your main() is an indication that you're not thinking about the functions -- you only need one loop in main, the way you started.
raptr_dflo
Practically a Master Poster
602 posts since Aug 2010
Reputation Points: 76
Solved Threads: 82