Try declaring sum right before your for loop.
the power function
Collapse
X
-
Originally posted by logicodeahh ok I dont know why but that works so here is the thing
I input 5
then input 2
it says that the answer is 5
cout<<sum
declare vars
get input
call function
save function return value
print function return value
?Comment
-
-
Code:for (int i = 0; i < exp; i++);
Code:doStuff(); for (part1; part1; part3) { // no ';' here initialize.someVariable(); // ended with a semicolon } // no ';' here either doStuff(with.someVariable()); // ended with a semicolon
Comment
-
Before I begin...- Readers looking for Power C++ can find it at the link.
- Readers interested in the builtin C++ power function should include <cmath> and execute "std::pow".
To answer the question...
Code:Code removed - please read posting guidelines.
Comment
Comment