title: c++ Recursively multiply 2 integers using addition
body: <p>I'm trying to write code for homework that uses recursion and addition to multiply two integers together. But, I'm currently getting a lot of error messages, and I'm not even sure if I'm on the right track. And, just to double-check, this is recursive, right? I wrote another program for this problem which worked great until I realized it wasn't actually recursive. Here's the full code:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;iomanip&gt;
  using namespace std;
  int result;
  int m;
  int n;
  
  int rmultiply(int m, int n)
  {
      if(n &gt; 1)
          return(m + (rmultiply(n - 1)));
  
      else if ((m == 0) || (n == 0))
          return 0;
      else if (n == 1)
          return m;
  }
  
  int main(m, n)
      {
      cout &lt;&lt; "Enter two integers to multiply" &lt;&lt; endl; //prompt user to input 2 integers
      cin &gt;&gt; m &gt;&gt; n; //store them in variable m and n
  
      result = rmultiply(m,n);
      cout &lt;&lt; result;
      }
  </code></pre>
  
  <p>Error 1: Too few arguments to function 'int rmultiply(int, int)'</p>
  
  <pre><code>return(m + (rmultiply(n - 1)));
  </code></pre>
  
  <p>Warning: control reaches end of non-void function</p>
  
  <p>Error 2(for code lines below): Expression list treated as compound expression in initializer</p>
  
  <p>Error 3: Expected ',' or ';' before'{' token</p>
  
  <p>Warning: left operand of comma operator has no effect</p>
  
  <pre><code>int main(m, n)
  {
  </code></pre>
  
  <p>Any help would be appreciated!</p>