//// main.m// NSNumber数字的使用//// Created by on 14-10-5.// Copyright (c) 2014年 apple. All rights reserved.//#importint main(int argc, const char * argv[]) { @autoreleasepool {// 使用NSNumber为基本数据类型进行封装 NSNumber *monthNumber = [NSNumber numberWithInt:10]; NSNumber *lengthNumber = [NSNumber numberWithFloat:10.8]; NSLog(@"month = %@", monthNumber); NSLog(@"lengthNumber = %@", lengthNumber); // 还原成基本数据类型 int month = [monthNumber intValue]; float length = [lengthNumber floatValue]; NSLog(@"month = %d", month); NSLog(@"length = %.2f", length); } return 0;}