title: Writing a function that returns a base and an exponent
body: <p>I recently bought the C++ How to Program, Early Objects Version 9th edition to better verse myself in C++ programming. I am on chapter 6 of the book and I am in the questions section and I am having trouble with this question.</p>
  
  <p>Write a single function <code>integerPower(base, exponent)</code> that returns the value of <code>base ^ exponent</code></p>
  
  <p>For example, <code>integerPower(3, 4) = 3 * 3 * 3 * 3</code>. Assume that exponent is a positive, nonzero, integer, and that base is an integer. <strong>DO NOT USE ANY MATH LIBRARY FUNCTIONS</strong></p>
  
  <p>I felt the need to put that in all caps and bold because they don't want me to use <code>#include &lt;cmath&gt;</code>. I could easily do this if I could use <code>pow(x, y)</code> but I cannot. This question has got me stumped. I will post the code I have so far! Maybe I am just not understanding the question properly. Any help would be very much appreciated. Also I know that my current code does not make much sense, but I have been trying other things. Thanks again</p>
  
  <pre><code>#include &lt;iostream&gt;
  
  using namespace std;
  
  int integerPower(int base, int exponent)
  {
      int answer = base * exponent;
      return answer;
  }
  
  
  int main()
  {
      cout &lt;&lt; integerPower(3, 4);
      return 0;
  }
  </code></pre>