SOURCE FILE: 160_long_division.cpp


#include<iostream>
using namespace std ;

int main (void)
{

   int numerator, denominator, quotient, remainder ;

   cout << endl ;
   cout << "This program reads positive integer numerator and denominator\n" ;
   cout << "from the user and then outputs the quotient and the remainder." ;
   cout << endl << endl ;

   cout << "Please enter a positive integer value for the numerator: " ;
   cin >> numerator ;

   do
   { 
     cout << "\nPlease enter a positive integer value for the denominator: " ;
     cin >> denominator ;
   } while (denominator <= 0) ; 

   quotient = numerator/denominator ;
   remainder = numerator % denominator ;

   cout << endl ;
   cout << "Your numerator is: " << numerator << endl ;
   cout << "Your denominator is: " << denominator << endl ;
   cout << "The quotient is: " << quotient << endl ;
   cout << "The remainder is: " << remainder << endl ;
   cout << endl ;
   cout << numerator << " = " 
        << quotient << " * " << denominator
        << " + " << remainder << ".\n" ;
   
   cout << endl ;

   return 0;
}