{"rsdb":{"rid":"380768","subhead":"","postdate":"0","aid":"265992","fid":"99","uid":"1","topic":"1","content":"
\n

1. \u76f4\u63a5\u8f6c\u5316<\/strong><\/h3> \n
\n
float<\/span> k = 1.6<\/span>;\r\n<\/span>int<\/span> a = (int<\/span>)k;\r\nNSLog(@<\/span>"<\/span>a = %d<\/span>"<\/span>,a);<\/pre> \n <\/div> \n 

\u8f93\u51fa\u7ed3\u679c\u662f1\uff0c(int) \u662f\u5f3a\u5236\u7c7b\u578b\u8f6c\u5316\uff0c\u76f4\u63a5\u4e22\u5f03\u6d6e\u70b9\u6570\u7684\u5c0f\u6570\u90e8\u5206\u3002<\/p> \n

2. floor \u51fd\u6570\u53d6\u6574\uff08\u5411\u4e0b\u53d6\u6574\uff09<\/strong><\/h3> \n
\n
float<\/span> k = 1.6<\/span>;\r\n<\/span>int<\/span> a = floor(k);\r\nNSLog(@<\/span>"<\/span>a = %d<\/span>"<\/span>,a);<\/pre> \n <\/div> \n 

\u8f93\u51fa\u7ed3\u679c\u662f1\uff0cfloor ( )\u65b9\u6cd5\u662f\u5411\u4e0b\u53d6\u6574\uff0c\u5bf9\u4e8e\u6b63\u6570\u6765\u8bf4\u662f\u820d\u5f03\u6d6e\u70b9\u6570\u90e8\u5206\uff0c\u5bf9\u4e8e\u590d\u6570\u6765\u8bf4\uff0c\u820d\u5f03\u6d6e\u70b9\u6570\u90e8\u5206\u540e\u518d\u51cf1\u3002\uff08\u6c42\u6700\u5927\u7684\u6574\u6570\u4f46\u4e0d\u5927\u4e8e\u672c\u8eab<\/code>\uff09<\/p> \n

3. ceil \u51fd\u6570\u53d6\u6574\uff08\u5411\u4e0a\u53d6\u6574\uff09<\/strong><\/h3> \n
\n
float<\/span> k = 1.3<\/span>;\r\n<\/span>int<\/span> a = ceil(k);\r\nNSLog(@<\/span>"<\/span>a = %d<\/span>"<\/span>,a);<\/pre> \n <\/div> \n 

\u8f93\u51fa\u7ed3\u679c\u662f2\uff0cceil ( )\u65b9\u6cd5\u662f\u5411\u4e0a\u53d6\u6574\uff0c\u5bf9\u4e8e\u6b63\u6570\u6765\u8bf4\u662f\u820d\u5f03\u6d6e\u70b9\u6570\u90e8\u5206\u5e76\u52a01\uff0c\u5bf9\u4e8e\u590d\u6570\u6765\u8bf4\u5c31\u662f\u820d\u5f03\u6d6e\u70b9\u6570\u90e8\u5206\u3002\uff08\u6c42\u6700\u5c0f\u7684\u6574\u6570\u4f46\u4e0d\u5c0f\u4e8e\u672c\u8eab<\/code>\uff09<\/p> \n

4. round \u51fd\u6570\u53d6\u6574\uff08\u56db\u820d\u4e94\u5165\u53d6\u6574\uff09<\/strong><\/h3> \n
\n
float<\/span> k = 1.6<\/span>;\r\n<\/span>int<\/span> a = round(k);\r\nNSLog(@<\/span>"<\/span>a = %d<\/span>"<\/span>,a);<\/pre> \n <\/div> \n 

\u8f93\u51fa\u7ed3\u679c\u662f2\uff0cround ( )\u65b9\u6cd5\u662f\u56db\u820d\u4e94\u5165\u53d6\u6574\u3002\uff08\u6c42\u672c\u8eab\u7684\u56db\u820d\u4e94\u5165<\/code>\uff09<\/p> \n<\/div>","orderid":"0","title":"iOS-\u5173\u4e8e\u4e00\u4e9b\u53d6\u6574\u65b9\u5f0f","smalltitle":"","mid":"0","fname":"iOS","special_id":"0","bak_id":"0","info":"0","hits":"17","pages":"1","comments":"0","posttime":"2019-11-15 18:40:45","list":"1573814445","username":"admin","author":"","copyfrom":"","copyfromurl":"","titlecolor":"","fonttype":"0","titleicon":"0","picurl":"https:\/\/www.cppentry.com\/upload_files\/","ispic":"0","yz":"1","yzer":"","yztime":"0","levels":"0","levelstime":"0","keywords":"iOS-<\/A> \u5173\u4e8e<\/A> \u4e00\u4e9b<\/A> \u65b9\u5f0f<\/A>","jumpurl":"","iframeurl":"","style":"","template":"a:3:{s:4:\"head\";s:0:\"\";s:4:\"foot\";s:0:\"\";s:8:\"bencandy\";s:0:\"\";}","target":"0","ip":"14.17.22.34","lastfid":"0","money":"0","buyuser":"","passwd":"","allowdown":"","allowview":"","editer":"","edittime":"0","begintime":"0","endtime":"0","description":"iOS-\u5173\u4e8e\u4e00\u4e9b\u53d6\u6574\u65b9\u5f0f","lastview":"1575884311","digg_num":"0","digg_time":"0","forbidcomment":"0","ifvote":"0","heart":"","htmlname":"","city_id":"0"},"page":"1"}