Don't like ads? PRO users don't see any ads ;-)
Guest

D Tuples

By: a guest on Aug 3rd, 2012  |  syntax: D  |  size: 0.34 KB  |  hits: 18  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. // Returns Tuple!(feet, inches)
  2. auto inchToFeet(int inches)
  3. {
  4.         return tuple(inches / 12, inches % 12);
  5. }
  6.  
  7. float inchToCm(int inches)
  8. {
  9.         // Shit nigga is dat tuple taking two arguments?
  10.         return inchToCm(getFeetAndInches(inches).tupleof);
  11. }
  12.  
  13. float inchToCm(int feet, int inches)
  14. {
  15.         return (feet * inchPerFoot + inches) * cmPerInch;
  16. }