SHARE
TWEET

Reduction

a guest Jan 20th, 2020 86 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. void Measure::simplify()
  2.     {
  3.         // make the amount bigger if it is less than 1, unless the unit is already
  4.         //"dram" (in which case the amount can't be made any bigger).
  5.         Measure temp;
  6.         while (unit!=0 && amount < 1) {
  7.             temp.amount = conversionTable[unit - 1];
  8.             amount = amount *temp.amount;
  9.                 unit--;
  10.         }
  11.         //make the amount smaller if it can be made smaller without making it
  12.          //less than 1, unless the unit is already acre_ft (in which case the
  13.         //amount can't be made any smaller)
  14.         while (unit!=11 && amount > 1 ) {
  15.            
  16.             temp.amount = conversionTable[unit];
  17.             amount *= (1 / temp.amount);
  18.                 unit++;
  19.         }
  20.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top