/* intdivision2.cpp displays a table of integer division results.
 *
 * Output: A table of the quotients and remainders produced by
 *         the divisions i/j with i and j running from 1 to 4.
 *****************************************************************/

#include <iostream>              // <<, cout, endl
#include <cassert>               // assert()

void DivideInts(int op1, int op2, int & quotient, int & remainder);

int main()
{
   cout << "                Division Table\n\n";

   int quot,                         // variables to hold the values
       rem;                          //  passed back from DivideInts()

   for (int j = 1; j <= 4; j++)
   {
      for (int i = 1; i <= 4; i++)
      {
         DivideInts(i, j, quot, rem);
         cout << i << " divided by " << j 
              << " gives a quotient of " << quot 
              << " and a remainder of " << rem << endl;
      }
      cout << endl;
   }

   return 0;
}

/* DivideInts performs integer division in 1-step.
 *
 * Receive:      op1 and op2, two integers.
 * Precondition: op2 is nonzero
 * Pass back:    quotient and remainder, two integers
 * Uses:         assert()
 ****************************************************************/

void DivideInts(int op1, int op2, int & quotient, int & remainder)
{
   assert (op2 != 0);
   quotient = op1 / op2;
   remainder = op1 % op2;
}
&\

