title: C++ Programming the division alogrithm
body: <blockquote>
    <p><sub>The division algorithm states that given two integers <em>a</em> and <em>d</em>, with <em>d</em> &ne; 0, there exists unique integers <em>q</em> and <em>r</em> such that <em>a = qd + r</em> and 0 <em>&le; r &lt; |d|</em>, where <em>|d|</em> denotes the absolute value of <em>d</em>. The integer <em>q</em> is the quotient, <em>r</em> is the remainder, <em>d</em> is the divisor, and <em>a</em> is the dividend. prompt the user for a dividend and divisor and then display the division algorithm's results:<br>
    <br>
    &nbsp;&nbsp; If <em>a</em> = 17 and <em>d</em> = 3, then <em>q</em> = 5 and <em>r</em> = 2, since 17 = 5 * 3 + 2.<br>
    &nbsp;&nbsp; If <em>a</em> = 17 and <em>d</em> = -3, then <em>q</em> = -5 and <em>r</em> = 2, since 17 = -5 * -3 + 2.<br></p>
  </blockquote>
  
  <p><br>
  The C++ operators for integer division do not conform to the division algorithm. Explain in output displayed to the user of the program when to expect results that disagree with the division algorithm. The program should not attempt to resolve this issue.</sub></p>
  
  <p>Ok, so I've been trying to figure this out for a few days now and I just can't crack it. The only way I can think of solving this is by using mod to find r or using a successive subtraction to find q. However, I'm pretty sure both of those solution don't really count. Is there some other way to solve this problem?</p>
  
  <p>[Edit] I don't think successive subtraction works because that's just Euclid's algorithm so I really wouldn't be using this algorithm and using modulus would just like using the C++ division operator.</p>