forked from davedelong/DDUnitConverter
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmain.m
32 lines (22 loc) · 1.04 KB
/
main.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#import <Foundation/Foundation.h>
#import "DDUnitConversion.h"
int main (int argc, const char * argv[]) {
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
DDUnitConverter *c = [DDUnitConverter velocityUnitConverter];
NSDecimalNumber * value = [c convertNumber:[NSDecimalNumber decimalNumberWithString:@"100"]
fromUnit:DDVelocityUnitMilesPerHour
toUnit:DDVelocityUnitFurlongsPerMicrofortnight];
NSLog(@"%@", value);
c = [DDUnitConverter currencyUnitConverter];
value = [c convertNumber:[NSDecimalNumber decimalNumberWithString:@"1"]
fromUnit:DDCurrencyUnitEuro
toUnit:DDCurrencyUnitUSDollar];
NSLog(@"%@", value);
c = [DDUnitConverter lengthUnitConverter];
value = [c convertNumber:[NSDecimalNumber decimalNumberWithString:@"1"]
fromUnit:DDLengthUnitKilometers
toUnit:DDLengthUnitMeters];
NSLog(@"%@", value);
[pool drain];
return 0;
}