2016-08-31 21:11:54.883 mylearn[596:34753] 10 2016-08-31 21:11:54.884 mylearn[596:34753] 12 2016-08-31 21:11:54.884 mylearn[596:34753] 0xa 2016-08-31 21:11:54.885 mylearn[596:34753] 3.141593 2016-08-31 21:11:54.885 mylearn[596:34753] 3.141593e+00 2016-08-31 21:11:54.885 mylearn[596:34753] 3.14159
#import <Foundation/Foundation.h> int main(int argc, const char * argv[]) { @autoreleasepool { // insert code here... NSLog(@"%i",10); NSLog(@"%o",10); NSLog(@"%#x",10); NSLog(@"%f",3.1415926); NSLog(@"%e",3.1415926); NSLog(@"%g",3.1415926); } return 0; }
i表示10进制
o表示8进制
#x表示带有ox前缀符的16进制
f表示符点数
e表示科学计数法
g表示以最短方式输出浮点数