SOURCE FILE: ex0205.cpp


//    
// Example 2.5. Program to convert a measurement in inches    
// to yards, feet, and inches   
//    
   
#include <iostream.h>
   
int main(void)   
{   
   int TotalNumInches = 158, // total length in inches     
       yards,                // # yards  in TotalNumInches 
       feet,                 // # feet   in TotalNumInches 
       inches;               // # inches in TotalNumInches 
   
   feet   = TotalNumInches / 12;   
   inches = TotalNumInches % 12;   
   
   yards  = feet / 3;   
   feet   = feet % 3;   
   
   cout << "In " <<  TotalNumInches << " inches there are "
        << yards << " yard(s), " << feet << " foot(feet), and "
        << inches << " inch(es)\n";
   
   return 0;
}