{"id":316,"date":"2020-11-02T16:26:46","date_gmt":"2020-11-02T20:26:46","guid":{"rendered":"http:\/\/www.prglab.com\/blog\/?page_id=316"},"modified":"2020-11-02T16:26:46","modified_gmt":"2020-11-02T20:26:46","slug":"constants","status":"publish","type":"page","link":"https:\/\/www.prglab.com\/blog\/cplusplus-tutorial\/cplusplus-basics\/constants","title":{"rendered":"\u5e38\u91cf"},"content":{"rendered":"\n<h2>1.3 \u5e38\u91cf \uff08Constants \uff09<\/h2>\n\n\n\n<p>\u4e00\u4e2a\u5e38\u91cf\uff08constant\uff09\u662f\u4e00\u4e2a\u6709\u56fa\u5b9a\u503c\u7684\u8868\u8fbe\u5f0f\u3002<\/p>\n\n\n\n<h3>\u5b57\uff08Literals\uff09<\/h3>\n\n\n\n<p>\u5b57\u662f\u7528\u6765\u5728\u7a0b\u5e8f\u6e90\u7801\u4e2d\u8868\u8fbe\u7279\u5b9a\u7684\u503c\u3002\u5728\u524d\u9762\u7684\u5185\u5bb9\u4e2d\u6211\u4eec\u5df2\u7ecf\u7528\u4e86\u5f88\u591a\u7684\u5b57\u6765\u7ed9\u53d8\u91cf\u8d4b\u4e88\u7279\u5b9a\u7684\u503c\u3002\u4f8b\u5982\uff1a<br>a = 5;<\/p>\n\n\n\n<p>\u8fd9\u53e5\u4ee3\u7801\u4e2d5\u5c31\u662f\u4e00\u4e2a\u5b57\u5e38\u91cf\u3002<\/p>\n\n\n\n<p>\u5b57\u5e38\u91cf(literal constant)\u53ef\u4ee5\u88ab\u5206\u4e3a\u6574\u6570(Integer Numbers), \u6d6e\u70b9\u6570(Floating-Point Numbers)\uff0c\u5b57\u7b26(Characters)\u548c\u5b57\u7b26\u4e32(Strings)\u3002<\/p>\n\n\n\n<h3>\u6574\u6570(Integer Numbers)<\/h3>\n\n\n\n<p>1776<br>707<br>-273<\/p>\n\n\n\n<p>\u4ed6\u4eec\u662f\u6574\u578b\u5e38\u6570\uff0c\u8868\u793a\u5341\u8fdb\u5236\u6574\u6570\u503c\u3002\u6ce8\u610f\u8868\u793a\u6574\u578b\u5e38\u6570\u65f6\u6211\u4eec\u4e0d\u9700\u8981\u4e9b\u5f15\u53f7\uff08quotes (&#8220;)\uff09\u6216\u4efb\u4f55\u7279\u6b8a\u5b57\u7b26\u3002\u6beb\u65e0\u7591\u95ee\u5b83\u662f\u4e2a\u5e38\u91cf\uff1a\u4efb\u4f55\u65f6\u5019\u5f53\u6211\u4eec\u5728\u7a0b\u5e8f\u4e2d\u51991776\uff0c\u6211\u4eec\u6307\u7684\u5c31\u662f1776\u8fd9\u4e2a\u6570\u503c\u3002<\/p>\n\n\n\n<p>\u9664\u5341\u8fdb\u5236\u6574\u6570\u53e6\u5916\uff0c C++\u8fd8\u5141\u8bb8\u4f7f\u7528\u516b\u8fdb\u5236\uff08octal numbers\uff09\u548c\u5341\u516d\u8fdb\u5236\uff08hexadecimal numbers\uff09\u7684\u5b57\u5e38\u91cf\uff08literal constants\uff09\u3002\u5982\u679c\u6211\u4eec\u60f3\u8981\u8868\u793a\u4e00\u4e2a\u516b\u8fdb\u5236\u6570\uff0c\u6211\u4eec\u5fc5\u987b\u5728\u5b83\u524d\u9762\u52a0\u4e0a\u4e00\u4e2a0\u5b57\u7b26(zero character)\uff0c\u800c\u8868\u793a\u5341\u516d\u8fdb\u5236\u6570\u6211\u4eec\u9700\u8981\u5728\u5b83\u524d\u9762\u52a0\u5b57\u7b260x (zero, x)\u3002\u4f8b\u5982\u4ee5\u4e0b\u5b57\u5e38\u91cf\uff08literal constants\uff09\u4e92\u76f8\u7b49\u503c\uff1a75&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\/\/ \u5341\u8fdb\u5236 decimal<br>0113&nbsp;\/\/ \u516b\u8fdb\u5236 octal<br>0x4b&nbsp;\/\/ \u5341\u516d\u8fdb\u5236 hexadecimal<\/p>\n\n\n\n<p>\u6240\u6709\u8fd9\u4e9b\u90fd\u8868\u793a\u540c\u4e00\u4e2a\u6574\u6570\uff1a 75 (seventy five) \uff0c\u5206\u522b\u4ee5\u5341\u8fdb\u5236\u6570\uff0c\u516b\u8fdb\u5236\u6570\u548c\u5341\u516d\u8fdb\u5236\u6570\u8868\u793a\u3002<\/p>\n\n\n\n<p>\u50cf\u53d8\u91cf\u4e00\u6837\uff0c\u5e38\u91cf\u4e5f\u662f\u6709\u6570\u636e\u7c7b\u578b\u7684\u3002\u9ed8\u8ba4\u7684\u6574\u6570\u5b57\u5e38\u91cf\u7684\u7c7b\u578b\u4e3aint\u578b\u3002\u6211\u4eec\u53ef\u4ee5\u901a\u8fc7\u5728\u540e\u9762\u52a0\u5b57\u6bcdu\u6216l\u6765\u8feb\u4f7f\u5b83\u4e3a\u65e0\u7b26\u53f7(unsigned)\u7684\u7c7b\u578b\u6216\u957f\u6574\u578b(long)\u3002<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">75         \/\/ int<br>75u        \/\/ unsigned int<br>75l        \/\/ long<br>75ul       \/\/ unsigned long<\/pre>\n\n\n\n<p>\u8fd9\u91cc\u540e\u7f00\uff55\u548c\uff4c\u53ef\u4ee5\u662f\u5927\u5199\uff0c\u4e5f\u53ef\u4ee5\u662f\u5c0f\u5199\u3002<\/p>\n\n\n\n<h3>\u6d6e\u70b9\u6570(Floating Point Numbers)<\/h3>\n\n\n\n<p>\u6d6e\u70b9\u6570\u4ee5\u5c0f\u6570\uff08decimals\uff09\u548c\uff0f\u6216\u6307\u6570\u5e42\uff08 exponents\uff09\u7684\u5f62\u5f0f\u8868\u793a\u3002\u5b83\u4eec\u53ef\u4ee5\u5305\u62ec\u4e00\u4e2a\u5c0f\u6570\u70b9\uff0c\u4e00\u4e2ae\u5b57\u7b26\uff08\u8868\u793a&#8221;by ten at the Xth height&#8221;\uff0c\u8fd9\u91ccX\u662f\u540e\u9762\u8ddf\u7684\u6574\u6570\u503c) \uff0c\u6216\u4e24\u8005\u90fd\u5305\u62ec\u30023.14159&nbsp;\/\/ 3.14159<br>6.02e23&nbsp;\/\/ 6.02 x 10^1023<br>1.6e-19&nbsp;\/\/ 1.6 x 10^-19<br>3.0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\/\/ 3.0<\/p>\n\n\n\n<p>\u4ee5\u4e0a\u662f\u5305\u542b\u5c0f\u6570\u7684\u4ee5\uff23++\u8868\u793a\u7684\uff14\u4e2a\u6709\u6548\u6570\u503c\u3002\u7b2c\u4e00\u4e2a\u662fPI\uff0c\u7b2c\u4e8c\u4e2a\u662fAvogadro\u6570\u4e4b\u4e00\uff0c\u7b2c\u4e09\u4e2a\u662f\u4e00\u4e2a\u7535\u5b50\uff08electron\uff09\u7684\u7535\u91cf\uff08electric charge\uff09(\u4e00\u4e2a\u6781\u5c0f\u7684\u6570\u503c) \u2013 \u6240\u6709\u8fd9\u4e9b\u90fd\u662f\u8fd1\u4f3c\u503c\u3002\u6700\u540e\u4e00\u4e2a\u662f\u6d6e\u70b9\u6570\u5b57\u5e38\u91cf\u8868\u793a\u65703\u3002<\/p>\n\n\n\n<p>\u6d6e\u70b9\u6570\u7684\u9ed8\u8ba4\u6570\u636e\u7c7b\u578b\u4e3adouble\u3002\u5982\u679c\u4f60\u60f3\u4f7f\u7528float\u6216long double\u7c7b\u578b\uff0c\u53ef\u4ee5\u5728\u540e\u9762\u52a0f\u6216l\u540e\u7f00\uff0c\u540c\u6837\u5927\u5c0f\u5199\u90fd\u53ef\u4ee5\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">3.14159L   \/\/ long double<br>6.02e23f   \/\/ float <\/pre>\n\n\n\n<h3>\u5b57\u7b26\u548c\u5b57\u7b26\u4e32\uff08Characters and strings\uff09<\/h3>\n\n\n\n<p>\u6b64\u5916\u8fd8\u6709\u975e\u6570\u5b57\u5e38\u91cf\uff0c\u4f8b\u5982\uff1a&#8217;z&#8217;<br>&#8216;p&#8217;<br>&#8220;Hello world&#8221;<br>&#8220;How do you do?&#8221;<\/p>\n\n\n\n<p>\u524d\u4e24\u4e2a\u8868\u8fbe\u5f0f\u8868\u793a\u5355\u72ec\u7684\u5b57\u7b26\uff08character\uff09\uff0c\u540e\u9762\u4e24\u4e2a\u8868\u793a\u7531\u82e5\u5e72\u5b57\u7b26\u7ec4\u6210\u7684\u5b57\u7b26\u4e32(string) \u3002\u6ce8\u610f\u5728\u8868\u793a\u5355\u72ec\u5b57\u7b26\u7684\u65f6\u5019\uff0c\u6211\u4eec\u7528\u5355\u5f15\u53f7\uff08single quotes (&#8216;)\uff09\uff0c\u5728\u8868\u793a\u5b57\u7b26\u4e32\u6216\u591a\u4e8e\u4e00\u4e2a\u5b57\u7b26\u7684\u65f6\u5019\u6211\u4eec\u7528\u53cc\u5f15\u53f7\uff08double quotes (&#8220;)\uff09\u3002<\/p>\n\n\n\n<p>\u5f53\u4ee5\u5e38\u91cf\u65b9\u5f0f\u8868\u793a\u5355\u4e2a\u5b57\u7b26\u548c\u5b57\u7b26\u4e32\u65f6\uff0c\u5fc5\u987b\u5199\u4e0a\u5f15\u53f7\u4ee5\u4fbf\u628a\u4ed6\u4eec\u548c\u53ef\u80fd\u7684\u53d8\u91cf\u6807\u8bc6\u6216\u4fdd\u7559\u5b57\u533a\u5206\u5f00\uff0c\u6ce8\u610f\u4ee5\u4e0b\u4f8b\u5b50\uff1ax<br>&#8216;x&#8217;<\/p>\n\n\n\n<p>x \u6307\u4e00\u4e2a\u53d8\u91cf\u540d\u79f0\u4e3a x, \u800c&#8217;x&#8217;\u6307\u5b57\u7b26\u5e38\u91cf&#8217;x&#8217;\u3002<\/p>\n\n\n\n<p>\u5b57\u7b26\u5e38\u91cf\u548c\u5b57\u7b26\u4e32\u5e38\u91cf\u5404\u6709\u7279\u70b9\uff0c\u4f8b\u5982escape codes\uff0c\u8fd9\u4e9b\u662f\u9664\u6b64\u4e4b\u5916\u65e0\u6cd5\u5728\u6e90\u7a0b\u5e8f\u4e2d\u8868\u793a\u7684\u7279\u6b8a\u7684\u5b57\u7b26\uff0c\u4f8b\u5982\u6362\u884c\u7b26 newline (\\n) \u6216\u8df3\u8dc3\u7b26tab (\\t)\u3002\u6240\u6709\u8fd9\u4e9b\u7b26\u53f7\u524d\u9762\u8981\u52a0\u4e00\u4e2a\u53cd\u659c\u6760inverted slash (\\)\u3002\u8fd9\u91cc\u5217\u51fa\u4e86\u8fd9\u4e9bescape codes\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td><strong>\\n<\/strong><\/td><td>\u6362\u884c\u7b26newline<\/td><\/tr><tr><td><strong>\\r<\/strong><\/td><td>\u56de\u8f66carriage return<\/td><\/tr><tr><td><strong>\\t<\/strong><\/td><td>\u8df3\u8dc3\u7b26tabulation<\/td><\/tr><tr><td><strong>\\v<\/strong><\/td><td>\u5782\u76f4\u8df3\u8dc3vertical tabulation<\/td><\/tr><tr><td><strong>\\b<\/strong><\/td><td>backspace<\/td><\/tr><tr><td><strong>\\f<\/strong><\/td><td>page feed<\/td><\/tr><tr><td><strong>\\a<\/strong><\/td><td>\u8b66\u544aalert (beep)<\/td><\/tr><tr><td><strong>\\&#8217;<\/strong><\/td><td>\u5355\u5f15\u53f7single quotes (&#8216;)<\/td><\/tr><tr><td><strong>\\&#8221;<\/strong><\/td><td>\u53cc\u5f15\u53f7double quotes (&#8220;)<\/td><\/tr><tr><td><strong>\\?<\/strong><\/td><td>\u95ee\u53f7question (?)<\/td><\/tr><tr><td><strong>\\\\<\/strong><\/td><td>\u53cd\u659c\u6760inverted slash (\\)<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>\u4f8b\u5982\uff1a&#8217;\\n&#8217;<br>&#8216;\\t&#8217;<br>&#8220;Left \\t Right&#8221;<br>&#8220;one\\ntwo\\nthree&#8221;<\/p>\n\n\n\n<p>\u53e6\u5916\u4f60\u53ef\u4ee5\u6570\u5b57ASCII \u7801\u8868\u793a\u4e00\u4e2a\u5b57\u7b26\uff0c\u8fd9\u79cd\u8868\u793a\u65b9\u5f0f\u662f\u5728\u53cd\u659c\u6760(\\)\u4e4b\u540e\u52a0\u4ee58\u8fdb\u5236\u6570\u6216\u5341\u516d\u8fdb\u5236\u6570\u8868\u793a\u7684ASCII \u7801\u3002\u5728\u7b2c\u4e00\u79cd\uff08\u516b\u8fdb\u5236octal\uff09\u8868\u793a\u4e2d\uff0c\u6570\u5b57\u5fc5\u9700\u7d27\u8ddf\u53cd\u659c\u6760(\u4f8b\u5982<strong>\\23<\/strong>\u6216<strong>\\40<\/strong>)\uff0c\u7b2c\u4e8c\u79cd(\u5341\u516d\u8fdb\u5236hexacedimal)\uff0c\u5fc5\u987b\u5728\u6570\u5b57\u4e4b\u524d\u5199\u4e00\u4e2ax\u5b57\u7b26(\u4f8b\u5982<strong>\\x20<\/strong>\u6216<strong>\\x4A<\/strong>)\u3002<\/p>\n\n\n\n<p>\u5982\u679c\u6bcf\u4e00\u884c\u4ee3\u7801\u4ee5\u53cd\u659c\u6760inverted slash (\\)\u7ed3\u675f\uff0c\u5b57\u7b26\u4e32\u5e38\u91cf\u53ef\u4ee5\u5206\u591a\u884c\u4ee3\u7801\u8868\u793a\uff1a&#8221;string expressed in \\<br>two lines&#8221;<\/p>\n\n\n\n<p>\u4f60\u8fd8\u53ef\u4ee5\u5c06\u591a\u4e2a\u88ab\u7a7a\u683cblankspace\u3001\u8df3\u8dc3\u7b26tabulator\u3001\u6362\u884c\u7b26newline\u6216\u5176\u4ed6\u6709\u6548\u7a7a\u767d\u7b26\u53f7\u5206\u9694\u5f00\u7684\u5b57\u7b26\u4e32\u5e38\u91cf\u8fde\u63a5\u5728\u4e00\u8d77\uff1a&#8221;we form&#8221; &#8220;a single&#8221; &#8220;string&#8221; &#8220;of characters&#8221;<\/p>\n\n\n\n<p>\u6700\u540e\u5982\u679c\u6211\u4eec\u60f3\u8ba9\u5b57\u7b26\u4e32\u4f7f\u7528\u5bbd\u5b57\u7b26\uff08wchar_t)\uff0c\u800c\u4e0d\u662f\u7a84\u5b57\u7b26(char)\uff0c\u53ef\u4ee5\u5728\u5e38\u91cf\u7684\u524d\u9762\u52a0\u524d\u7f00L\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">L\"This is a wide character string\"<\/pre>\n\n\n\n<p>\u5bbd\u5b57\u7b26\u901a\u5e38\u7528\u6765\u5b58\u50a8\u975e\u82f1\u8bed\u5b57\u7b26\uff0c\u6bd4\u5982\u4e2d\u6587\u5b57\u7b26\uff0c\u4e00\u4e2a\u5b57\u7b26\u5360\u4e24\u4e2a\u5b57\u8282\u3002<\/p>\n\n\n\n<p>\u5e03\u5c14\u578b\u5e38\u91cf(Boolean Literals)<\/p>\n\n\n\n<p>\u5e03\u5c14\u578b\u53ea\u6709\u4e24\u4e2a\u6709\u6548\u7684\u503c\uff1atrue\u548cfalse\uff0c\u5176\u6570\u636e\u7c7b\u578b\u4e3abool\u3002<\/p>\n\n\n\n<h3>\u5b9a\u4e49\u5e38\u91cfDefined constants (#define)<\/h3>\n\n\n\n<p>\u4f7f\u7528\u9884\u5904\u7406\u5668\u6307\u4ee4#define\uff0c\u4f60\u53ef\u4ee5\u5c06\u90a3\u4e9b\u4f60\u7ecf\u5e38\u4f7f\u7528\u7684\u5e38\u91cf\u5b9a\u4e49\u4e3a\u4f60\u81ea\u5df1\u53d6\u7684\u540d\u5b57\u800c\u4e0d\u9700\u8981\u501f\u52a9\u4e8e\u53d8\u91cf\u3002\u5b83\u7684\u683c\u5f0f\u662f\uff1a<\/p>\n\n\n\n<p><code>#define identifier value<\/code><\/p>\n\n\n\n<p>\u4f8b\u5982\uff1a#define PI 3.14159265<br>#define NEWLINE &#8216;\\n&#8217;<br>#define WIDTH 100<\/p>\n\n\n\n<p>\u4ee5\u4e0a\u5b9a\u4e49\u4e86\u4e09\u4e2a\u5e38\u91cf\u3002\u4e00\u65e6\u505a\u4e86\u8fd9\u4e9b\u58f0\u660e\uff0c\u4f60\u53ef\u4ee5\u5728\u540e\u9762\u7684\u7a0b\u5e8f\u4e2d\u4f7f\u7528\u8fd9\u4e9b\u5e38\u91cf\uff0c\u5c31\u50cf\u4f7f\u7528\u5176\u5b83\u4efb\u4f55\u5e38\u91cf\u4e00\u6837\uff0c\u4f8b\u5982\uff1acircle = 2 * PI * r;<br>cout &lt;&lt; NEWLINE;<\/p>\n\n\n\n<p>\u5b9e\u9645\u4e0a\u7f16\u8bd1\u5668\u5728\u9047\u5230#define\u6307\u4ee4\u7684\u65f6\u5019\u505a\u7684\u53ea\u662f\u628a\u4efb\u4f55\u51fa\u73b0\u8fd9\u4e9b \u5e38\u91cf\u540d\uff08\u5728\u524d\u9762\u7684\u4f8b\u5b50\u4e2d\u4e3aPI, NEWLINE\u6216WIDTH\uff09\u7684\u5730\u65b9\u66ff\u6362\u6210\u4ed6\u4eec\u88ab\u5b9a\u4e49\u4e3a\u7684\u4ee3\u7801\uff08\u5206\u522b\u4e3a3.14159265, &#8216;\\n&#8217;\u548c100\uff09\u3002\u56e0\u6b64\uff0c\u7531#define\u5b9a\u4e49\u7684\u5e38\u91cf\u88ab\u79f0\u4e3a\u5b8f\u5e38\u91cfmacro constants\u3002<\/p>\n\n\n\n<p>#define \u6307\u4ee4\u4e0d\u662f\u4ee3\u7801\u8bed\u53e5\uff0c\u5b83\u662f\u9884\u5904\u7406\u5668\u6307\u4ee4\uff0c\u56e0\u6b64\u6307\u4ee4\u884c\u672b\u5c3e\u4e0d\u9700\u8981\u52a0\u5206\u53f7semicolon (;) \u3002\u5982\u679c\u4f60\u5728\u5b8f\u5b9a\u4e49\u884c\u672b\u5c3e\u52a0\u4e86\u5206\u53f7(;) \uff0c\u5f53\u9884\u5904\u7406\u5668\u5728\u7a0b\u5e8f\u4e2d\u505a\u5e38\u91cf\u66ff\u6362\u7684\u65f6\u5019\uff0c\u5206\u53f7\u4e5f\u4f1a\u88ab\u52a0\u5230\u88ab\u66ff\u6362\u7684\u884c\u4e2d\uff0c\u8fd9\u6837\u53ef\u80fd\u5bfc\u81f4\u9519\u8bef\u3002<\/p>\n\n\n\n<h3>\u58f0\u660e\u5e38\u91cfdeclared constants (const)<\/h3>\n\n\n\n<p>\u901a\u8fc7\u4f7f\u7528const\u524d\u7f00\uff0c\u4f60\u53ef\u4ee5\u5b9a\u4e49\u6307\u5b9a\u7c7b\u578b\u7684\u5e38\u91cf\uff0c\u5c31\u50cf\u5b9a\u4e49\u4e00\u4e2a\u53d8\u91cf\u4e00\u6837:const int width = 100;<br>const char tab = &#8216;\\t&#8217;;<br>const zip = 12440;<\/p>\n\n\n\n<p>\u5982\u679c\u6ca1\u6709\u6307\u5b9a\u7c7b\u578b(\u5982\u4e0a\u9762\u6700\u540e\u4f8b\u5b50\u4e2d\u6700\u540e\u4e00\u884c)\uff0c\u7f16\u8bd1\u5668\u4f1a\u5047\u8bbe\u5e38\u91cf\u4e3a\u6574\u578bint\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>1.3 \u5e38\u91cf \uff08Constants \uff09 \u4e00\u4e2a\u5e38\u91cf\uff08constant\uff09\u662f\u4e00\u4e2a\u6709\u56fa\u5b9a\u503c\u7684\u8868\u8fbe\u5f0f\u3002 \u5b57\uff08Literals\uff09 \u5b57\u662f\u7528\u6765\u5728\u7a0b\u5e8f\u6e90\u7801\u4e2d\u8868\u8fbe\u7279\u5b9a\u7684\u503c\u3002\u5728\u524d\u9762\u7684\u5185\u5bb9\u4e2d\u6211\u4eec\u5df2\u7ecf\u7528\u4e86\u5f88\u591a\u7684\u5b57\u6765\u7ed9\u53d8\u91cf\u8d4b\u4e88\u7279\u5b9a\u7684\u503c\u3002\u4f8b\u5982\uff1aa = 5; \u8fd9\u53e5\u4ee3\u7801\u4e2d5\u5c31\u662f\u4e00\u4e2a\u5b57\u5e38\u91cf\u3002 \u5b57\u5e38\u91cf(literal constant)\u53ef\u4ee5\u88ab\u5206\u4e3a\u6574\u6570(Integer Numbers), \u6d6e\u70b9\u6570(Floating-Point Numbers)\uff0c\u5b57\u7b26(Characters)\u548c\u5b57\u7b26\u4e32(Strings)\u3002 \u6574\u6570(Integer Numbers) 1776707-273 \u4ed6\u4eec\u662f\u6574\u578b\u5e38\u6570\uff0c\u8868\u793a\u5341\u8fdb\u5236\u6574\u6570\u503c\u3002\u6ce8\u610f\u8868\u793a\u6574\u578b\u5e38\u6570\u65f6\u6211\u4eec\u4e0d\u9700\u8981\u4e9b\u5f15\u53f7\uff08quotes (&#8220;)\uff09\u6216\u4efb\u4f55\u7279\u6b8a\u5b57\u7b26\u3002\u6beb\u65e0\u7591\u95ee\u5b83\u662f\u4e2a\u5e38\u91cf\uff1a\u4efb\u4f55\u65f6\u5019\u5f53\u6211\u4eec\u5728\u7a0b\u5e8f\u4e2d\u51991776\uff0c\u6211\u4eec\u6307\u7684\u5c31\u662f1776\u8fd9\u4e2a\u6570\u503c\u3002 \u9664\u5341\u8fdb\u5236\u6574\u6570\u53e6\u5916\uff0c C++\u8fd8\u5141\u8bb8\u4f7f\u7528\u516b\u8fdb\u5236\uff08octal numbers\uff09\u548c\u5341\u516d\u8fdb\u5236\uff08hexadecimal numbers\uff09\u7684\u5b57\u5e38\u91cf\uff08literal constants\uff09\u3002\u5982\u679c\u6211\u4eec\u60f3\u8981\u8868\u793a\u4e00\u4e2a\u516b\u8fdb\u5236\u6570\uff0c\u6211\u4eec\u5fc5\u987b\u5728\u5b83\u524d\u9762\u52a0\u4e0a\u4e00\u4e2a0\u5b57\u7b26(zero character)\uff0c\u800c\u8868\u793a\u5341\u516d\u8fdb\u5236\u6570\u6211\u4eec\u9700\u8981\u5728\u5b83\u524d\u9762\u52a0\u5b57\u7b260x (zero, x)\u3002\u4f8b\u5982\u4ee5\u4e0b\u5b57\u5e38\u91cf\uff08literal constants\uff09\u4e92\u76f8\u7b49\u503c\uff1a75&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\/\/ \u5341\u8fdb\u5236 decimal0113&nbsp;\/\/ \u516b\u8fdb\u5236 octal0x4b&nbsp;\/\/ \u5341\u516d\u8fdb\u5236 hexadecimal \u6240\u6709\u8fd9\u4e9b\u90fd\u8868\u793a\u540c\u4e00\u4e2a\u6574\u6570\uff1a 75 (seventy five) \uff0c\u5206\u522b\u4ee5\u5341\u8fdb\u5236\u6570\uff0c\u516b\u8fdb\u5236\u6570\u548c\u5341\u516d\u8fdb\u5236\u6570\u8868\u793a\u3002 \u50cf\u53d8\u91cf\u4e00\u6837\uff0c\u5e38\u91cf\u4e5f\u662f\u6709\u6570\u636e\u7c7b\u578b\u7684\u3002\u9ed8\u8ba4\u7684\u6574\u6570\u5b57\u5e38\u91cf\u7684\u7c7b\u578b\u4e3aint\u578b\u3002\u6211\u4eec\u53ef\u4ee5\u901a\u8fc7\u5728\u540e\u9762\u52a0\u5b57\u6bcdu\u6216l\u6765\u8feb\u4f7f\u5b83\u4e3a\u65e0\u7b26\u53f7(unsigned)\u7684\u7c7b\u578b\u6216\u957f\u6574\u578b(long)\u3002 75 \/\/ int75u \/\/ unsigned int75l \/\/ long75ul \/\/ unsigned long \u8fd9\u91cc\u540e\u7f00\uff55\u548c\uff4c\u53ef\u4ee5\u662f\u5927\u5199\uff0c\u4e5f\u53ef\u4ee5\u662f\u5c0f\u5199\u3002 \u6d6e\u70b9\u6570(Floating Point [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":309,"menu_order":2,"comment_status":"closed","ping_status":"closed","template":"","meta":[],"_links":{"self":[{"href":"https:\/\/www.prglab.com\/blog\/wp-json\/wp\/v2\/pages\/316"}],"collection":[{"href":"https:\/\/www.prglab.com\/blog\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.prglab.com\/blog\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.prglab.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.prglab.com\/blog\/wp-json\/wp\/v2\/comments?post=316"}],"version-history":[{"count":1,"href":"https:\/\/www.prglab.com\/blog\/wp-json\/wp\/v2\/pages\/316\/revisions"}],"predecessor-version":[{"id":317,"href":"https:\/\/www.prglab.com\/blog\/wp-json\/wp\/v2\/pages\/316\/revisions\/317"}],"up":[{"embeddable":true,"href":"https:\/\/www.prglab.com\/blog\/wp-json\/wp\/v2\/pages\/309"}],"wp:attachment":[{"href":"https:\/\/www.prglab.com\/blog\/wp-json\/wp\/v2\/media?parent=316"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}