{"id":30,"date":"2009-07-12T14:32:00","date_gmt":"2009-07-12T06:32:00","guid":{"rendered":"http:\/\/gsakd878.wordpress.com\/2009\/07\/12\/%e9%ab%98%e8%b4%a8%e9%87%8fc%e6%95%99%e7%a8%8b-%e7%ac%ac2%e7%ab%a0-%e7%a8%8b%e5%ba%8f%e7%9a%84%e7%89%88%e5%bc%8f"},"modified":"2009-07-12T14:32:00","modified_gmt":"2009-07-12T06:32:00","slug":"%e9%ab%98%e8%b4%a8%e9%87%8fc%e6%95%99%e7%a8%8b-%e7%ac%ac2%e7%ab%a0-%e7%a8%8b%e5%ba%8f%e7%9a%84%e7%89%88%e5%bc%8f","status":"publish","type":"post","link":"https:\/\/www.keyboardmeow.com\/?p=30","title":{"rendered":"\u9ad8\u8d28\u91cfC++\u6559\u7a0b &#8212; \u7b2c2\u7ae0 \u7a0b\u5e8f\u7684\u7248\u5f0f"},"content":{"rendered":"<div style=\"margin-top:15px;margin-bottom:15px;\"><span>\u9ad8\u8d28\u91cfC++\u6559\u7a0b -- \u7b2c2\u7ae0 \u7a0b\u5e8f\u7684\u7248\u5f0f<\/span><\/div>\n<div style=\"line-height:20px;background-color:#dddddd;height:20px;color:#666666;\">\n\u6765\u6e90:<a href=\"http:\/\/www.vcworld.net\/\" target=\"_blank\" rel=\"noopener\"><font color=\"#0033FF\">www.vcworld.net<\/font><\/a>\u3000<\/div>\n<div style=\"text-align:left;margin-top:20px;width:95%;margin-bottom:25px;\">\n<p><span>\u7248\u5f0f\u867d\u7136\u4e0d\u4f1a\u5f71\u54cd\u7a0b\u5e8f\u7684\u529f\u80fd\uff0c\u4f46\u4f1a\u5f71\u54cd\u53ef\u8bfb\u6027\u3002\u7a0b\u5e8f\u7684\u7248\u5f0f\u8ffd\u6c42\u6e05\u6670\u3001\u7f8e\u89c2\uff0c\u662f\u7a0b\u5e8f\u98ce\u683c\u7684\u91cd\u8981\u6784\u6210\u56e0\u7d20\u3002<\/span><\/p>\n<p>\n\u53ef\u4ee5\u628a\u7a0b\u5e8f\u7684\u7248\u5f0f\u6bd4\u55bb\u4e3a\u201c\u4e66\u6cd5\u201d\u3002\u597d\u7684\u201c\u4e66\u6cd5\u201d\u53ef\u8ba9\u4eba\u5bf9\u7a0b\u5e8f\u4e00\u76ee\u4e86\u7136\uff0c\u770b\u5f97\u5174\u81f4\u52c3\u52c3\u3002\u5dee\u7684\u7a0b\u5e8f\u201c\u4e66\u6cd5\u201d\u5982\u8783\u87f9\u722c\u884c\uff0c\u8ba9\u4eba\u770b\u5f97\u7d22\u7136\u65e0\u5473\uff0c\u66f4\u4ee4\u7ef4\u62a4\u8005\u70e6\u607c\u6709\u52a0\u3002\u8bf7\u7a0b\u5e8f\u5458\u4eec\u5b66\u4e60\u7a0b\u5e8f\u7684\u201c\u4e66\u6cd5\u201d\uff0c\u5f25\u8865\u5927\u5b66\u8ba1\u7b97\u673a\u6559\u80b2\u7684\u6f0f\u6d1e\uff0c\u5b9e\u5728\u5f88\u6709\u5fc5\u8981\u3002<\/p>\n<p>\u00a0<\/p>\n<p><strong><font size=\"4\">2.1 \u7a7a\u884c<\/font><\/strong><\/p>\n<p>\n\u7a7a\u884c\u8d77\u7740\u5206\u9694\u7a0b\u5e8f\u6bb5\u843d\u7684\u4f5c\u7528\u3002\u7a7a\u884c\u5f97\u4f53\uff08\u4e0d\u8fc7\u591a\u4e5f\u4e0d\u8fc7\u5c11\uff09\u5c06\u4f7f\u7a0b\u5e8f\u7684\u5e03\u5c40\u66f4\u52a0\u6e05\u6670\u3002\u7a7a\u884c\u4e0d\u4f1a\u6d6a\u8d39\u5185\u5b58\uff0c\u867d\u7136\u6253\u5370\u542b\u6709\u7a7a\u884c\u7684\u7a0b\u5e8f\u662f\u4f1a\u591a\u6d88\u8017\u4e00\u4e9b\u7eb8\u5f20\uff0c\u4f46\u662f\u503c\u5f97\u3002\u6240\u4ee5\u4e0d\u8981\u820d\u4e0d\u5f97\u7528\u7a7a\u884c\u3002<\/p>\n<p>\u00a0<\/p>\n<p>\u25cf\u3010\u89c4\u52192-1-1\u3011\u5728\u6bcf\u4e2a\u7c7b\u58f0\u660e\u4e4b\u540e\u3001\u6bcf\u4e2a\u51fd\u6570\u5b9a\u4e49\u7ed3\u675f\u4e4b\u540e\u90fd\u8981\u52a0\u7a7a\u884c\u3002\u53c2\u89c1\u793a\u4f8b2-1\uff08a\uff09<\/p>\n<p>\u25cf\u3010\u89c4\u52192-1-2\u3011\u5728\u4e00\u4e2a\u51fd\u6570\u4f53\u5185\uff0c\u903b\u63d6\u4e0a\u5bc6\u5207\u76f8\u5173\u7684\u8bed\u53e5\u4e4b\u95f4\u4e0d\u52a0\u7a7a\u884c\uff0c\u5176\u5b83\u5730\u65b9\u5e94\u52a0\u7a7a\u884c\u5206\u9694\u3002\u53c2\u89c1\u793a\u4f8b2-1\uff08b \uff09<\/p>\n<table border=\"1\" cellspacing=\"0\" cellpadding=\"8\" width=\"600\" align=\"center\">\n<tbody>\n<tr>\n<td>\n<p>\/\/ \u7a7a\u884c<\/p>\n<p>void Function1(\u2026)<\/p>\n<p>{<\/p>\n<p>\u2026<\/p>\n<p>}<\/p>\n<p>\/\/ \u7a7a\u884c<\/p>\n<p>void Function2(\u2026)<\/p>\n<p>{<\/p>\n<p>\u2026<\/p>\n<p>}<\/p>\n<p>\/\/ \u7a7a\u884c<\/p>\n<p>void Function3(\u2026)<\/p>\n<p>{<\/p>\n<p>\u2026<\/p>\n<p>}<\/p>\n<p><\/p>\n<\/td>\n<td>\n<p>\/\/ \u7a7a\u884c<\/p>\n<p>while (condition)<\/p>\n<p>{<\/p>\n<p>statement1;<\/p>\n<p>\/\/ \u7a7a\u884c<\/p>\n<p>if (condition)<\/p>\n<p>{<\/p>\n<p>statement2;<\/p>\n<p>}<\/p>\n<p>else<\/p>\n<p>{<\/p>\n<p>statement3;<\/p>\n<p>}<\/p>\n<p>\/\/ \u7a7a\u884c<\/p>\n<p>statement4;<\/p>\n<p>}<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p align=\"center\">\u793a\u4f8b2-1(a)<br \/>\n\u51fd\u6570\u4e4b\u95f4\u7684\u7a7a\u884c\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<br \/>\n\u793a\u4f8b2-1(b) \u51fd\u6570\u5185\u90e8\u7684\u7a7a\u884c<\/p>\n<p>\u00a0<\/p>\n<p><strong><font size=\"4\">2.2 \u4ee3\u7801\u884c<\/font><\/strong><\/p>\n<p>\u25cf\u3010\u89c4\u52192-2-1\u3011\u4e00\u884c\u4ee3\u7801\u53ea\u505a\u4e00\u4ef6\u4e8b\u60c5\uff0c\u5982\u53ea\u5b9a\u4e49\u4e00\u4e2a\u53d8\u91cf\uff0c\u6216\u53ea\u5199\u4e00\u6761\u8bed\u53e5\u3002\u8fd9\u6837\u7684\u4ee3\u7801\u5bb9\u6613\u9605\u8bfb\uff0c\u5e76\u4e14\u65b9\u4fbf\u4e8e\u5199\u6ce8\u91ca\u3002<\/p>\n<p>\n\u25cf\u3010\u89c4\u52192-2-2\u3011if\u3001for\u3001while\u3001do\u7b49\u8bed\u53e5\u81ea\u5360\u4e00\u884c\uff0c\u6267\u884c\u8bed\u53e5\u4e0d\u5f97\u7d27\u8ddf\u5176\u540e\u3002\u4e0d\u8bba\u6267\u884c\u8bed\u53e5\u6709\u591a\u5c11\u90fd\u8981\u52a0{}\u3002\u8fd9\u6837\u53ef\u4ee5\u9632\u6b62\u4e66\u5199\u5931\u8bef\u3002<\/p>\n<table border=\"1\" cellspacing=\"0\" cellpadding=\"8\" width=\"600\" align=\"center\">\n<tbody>\n<tr>\n<td>\n<p>int width; \/\/ \u5bbd\u5ea6<\/p>\n<p>int height; \/\/ \u9ad8\u5ea6<\/p>\n<p>int depth; \/\/ \u6df1\u5ea6<\/p>\n<p><\/p>\n<\/td>\n<td>int width, height, depth; \/\/ \u5bbd\u5ea6\u9ad8\u5ea6\u6df1\u5ea6<\/td>\n<\/tr>\n<tr>\n<td>\n<p>x = a + b;<\/p>\n<p>y = c + d;<\/p>\n<p>z = e + f;<\/p>\n<\/td>\n<td>X \uff1d a + b; y = c + d; z = e + f;<\/td>\n<\/tr>\n<tr>\n<td>\n<p>if (width &lt; height)<\/p>\n<p>{<\/p>\n<p>dosomething();<\/p>\n<p>}<\/p>\n<\/td>\n<td>if (width &lt; height) dosomething();<\/td>\n<\/tr>\n<tr>\n<td>\n<p>for (initialization; condition; update)<\/p>\n<p>{<\/p>\n<p>dosomething();<\/p>\n<p>}<\/p>\n<p>\/\/ \u7a7a\u884c<\/p>\n<p>other();<\/p>\n<\/td>\n<td>\n<p>for (initialization; condition; update)<\/p>\n<p>dosomething();<\/p>\n<p>other();<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p align=\"center\">\u793a\u4f8b2-2(a)<br \/>\n\u98ce\u683c\u826f\u597d\u7684\u4ee3\u7801\u884c\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<br \/>\n\u793a\u4f8b2-2(b) \u98ce\u683c\u4e0d\u826f\u7684\u4ee3\u7801\u884c<\/p>\n<p>\u00a0<\/p>\n<p>\u25cf\u3010\u5efa\u8bae2-2-1\u3011\u5c3d\u53ef\u80fd\u5728\u5b9a\u4e49\u53d8\u91cf\u7684\u540c\u65f6\u521d\u59cb\u5316\u8be5\u53d8\u91cf\uff08\u5c31\u8fd1\u539f\u5219\uff09<\/p>\n<p>\n\u5982\u679c\u53d8\u91cf\u7684\u5f15\u7528\u5904\u548c\u5176\u5b9a\u4e49\u5904\u76f8\u9694\u6bd4\u8f83\u8fdc\uff0c\u53d8\u91cf\u7684\u521d\u59cb\u5316\u5f88\u5bb9\u6613\u88ab\u5fd8\u8bb0\u3002\u5982\u679c\u5f15\u7528\u4e86\u672a\u88ab\u521d\u59cb\u5316\u7684\u53d8\u91cf\uff0c\u53ef\u80fd\u4f1a\u5bfc\u81f4\u7a0b\u5e8f\u9519\u8bef\u3002\u672c\u5efa\u8bae\u53ef\u4ee5\u51cf\u5c11\u9690\u60a3\u3002\u4f8b\u5982<\/p>\n<p>int width = 10; \/\/ \u5b9a\u4e49\u5e76\u521d\u7ed0\u5316width<\/p>\n<p>int height = 10; \/\/ \u5b9a\u4e49\u5e76\u521d\u7ed0\u5316height<\/p>\n<p>int depth = 10; \/\/ \u5b9a\u4e49\u5e76\u521d\u7ed0\u5316depth<\/p>\n<p>\u00a0<\/p>\n<p>\u00a0<\/p>\n<p><strong><font size=\"4\">2.3 \u4ee3\u7801\u884c\u5185\u7684\u7a7a\u683c<\/font><\/strong><\/p>\n<p>\u25cf\u3010\u89c4\u52192-3-1\u3011\u5173\u952e\u5b57\u4e4b\u540e\u8981\u7559\u7a7a\u683c\u3002\u8c61const\u3001virtual\u3001inline\u3001case<br \/>\n\u7b49\u5173\u952e\u5b57\u4e4b\u540e\u81f3\u5c11\u8981\u7559\u4e00\u4e2a\u7a7a\u683c\uff0c\u5426\u5219\u65e0\u6cd5\u8fa8\u6790\u5173\u952e\u5b57\u3002\u8c61if\u3001for\u3001while\u7b49\u5173\u952e\u5b57\u4e4b\u540e\u5e94\u7559\u4e00\u4e2a\u7a7a\u683c\u518d\u8ddf\u5de6\u62ec\u53f7\u2018\uff08\u2019\uff0c\u4ee5\u7a81\u51fa\u5173\u952e\u5b57\u3002<\/p>\n<p>\u25cf\u3010\u89c4\u52192-3-2\u3011\u51fd\u6570\u540d\u4e4b\u540e\u4e0d\u8981\u7559\u7a7a\u683c\uff0c\u7d27\u8ddf\u5de6\u62ec\u53f7\u2018\uff08\u2019\uff0c\u4ee5\u4e0e\u5173\u952e\u5b57\u533a\u522b\u3002<\/p>\n<p>\u25cf\u3010\u89c4\u52192-3-3\u3011\u2018\uff08\u2019\u5411\u540e\u7d27\u8ddf\uff0c\u2018\uff09\u2019\u3001\u2018\uff0c\u2019\u3001\u2018;\u2019\u5411\u524d\u7d27\u8ddf\uff0c\u7d27\u8ddf\u5904\u4e0d\u7559\u7a7a\u683c\u3002<\/p>\n<p>\u25cf\u3010\u89c4\u52192-3-4\u3011\u2018\uff0c\u2019\u4e4b\u540e\u8981\u7559\u7a7a\u683c\uff0c\u5982Function(x, y,<br \/>\nz)\u3002\u5982\u679c\u2018;\u2019\u4e0d\u662f\u4e00\u884c\u7684\u7ed3\u675f\u7b26\u53f7\uff0c\u5176\u540e\u8981\u7559\u7a7a\u683c\uff0c\u5982for (initialization; condition;<br \/>\nupdate)\u3002<\/p>\n<p>\u25cf\u3010\u89c4\u52192-3-5\u3011\u8d4b\u503c\u64cd\u4f5c\u7b26\u3001\u6bd4\u8f83\u64cd\u4f5c\u7b26\u3001\u7b97\u672f\u64cd\u4f5c\u7b26\u3001\u903b\u8f91\u64cd\u4f5c\u7b26\u3001\u4f4d\u57df\u64cd\u4f5c\u7b26\uff0c\u5982\u201c=\u201d\u3001\u201c+=\u201d<br \/>\n\u201c&gt;=\u201d\u3001\u201c&lt;=\u201d\u3001\u201c+\u201d\u3001\u201c*\u201d\u3001\u201c%\u201d\u3001\u201c&amp;&amp;\u201d\u3001\u201c||\u201d\u3001\u201c&lt;&lt;\u201d,\u201c^\u201d\u7b49\u4e8c\u5143\u64cd\u4f5c\u7b26\u7684\u524d\u540e\u5e94\u5f53\u52a0\u7a7a\u683c\u3002<\/p>\n<p>\n\u25cf\u3010\u89c4\u52192-3-6\u3011\u4e00\u5143\u64cd\u4f5c\u7b26\u5982\u201c!\u201d\u3001\u201c~\u201d\u3001\u201c++\u201d\u3001\u201c--\u201d\u3001\u201c&amp;\u201d\uff08\u5730\u5740\u8fd0\u7b97\u7b26\uff09\u7b49\u524d\u540e\u4e0d\u52a0\u7a7a\u683c\u3002<\/p>\n<p>\u25cf\u3010\u89c4\u52192-3-7\u3011\u8c61\u201c\uff3b\uff3d\u201d\u3001\u201c.\u201d\u3001\u201c-&gt;\u201d\u8fd9\u7c7b\u64cd\u4f5c\u7b26\u524d\u540e\u4e0d\u52a0\u7a7a\u683c\u3002<\/p>\n<p>\u25cf\u3010\u5efa\u8bae2-3-1\u3011\u5bf9\u4e8e\u8868\u8fbe\u5f0f\u6bd4\u8f83\u957f\u7684for\u8bed\u53e5\u548cif\u8bed\u53e5\uff0c\u4e3a\u4e86\u7d27\u51d1\u8d77\u89c1\u53ef\u4ee5\u9002\u5f53\u5730\u53bb\u6389\u4e00\u4e9b\u7a7a\u683c\uff0c\u5982for (i=0;<br \/>\ni&lt;10; i++)\u548cif ((a&lt;=b)<br \/>\n&amp;&amp; (c&lt;=d))<\/p>\n<table border=\"1\" cellspacing=\"0\" cellpadding=\"8\" width=\"600\" align=\"center\">\n<tbody>\n<tr>\n<td>\n<p>void Func1(int x, int y, int z); \/\/ \u826f\u597d\u7684\u98ce\u683c<\/p>\n<p>void Func1 (int x,int y,int z); \/\/ \u4e0d\u826f\u7684\u98ce\u683c<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>if (year &gt;= 2000) \/\/ \u826f\u597d\u7684\u98ce\u683c<\/p>\n<p>if(year&gt;=2000) \/\/ \u4e0d\u826f\u7684\u98ce\u683c<\/p>\n<p>if ((a&gt;=b) &amp;&amp;<br \/>\n(c&lt;=d)) \/\/ \u826f\u597d\u7684\u98ce\u683c<\/p>\n<p>\nif(a&gt;=b&amp;&amp;c&lt;=d)<br \/>\n\/\/ \u4e0d\u826f\u7684\u98ce\u683c<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>for (i=0; i&lt;10; i++) \/\/ \u826f\u597d\u7684\u98ce\u683c<\/p>\n<p>for(i=0;i&lt;10;i++) \/\/ \u4e0d\u826f\u7684\u98ce\u683c<\/p>\n<p>for (i = 0; I &lt; 10; i ++) \/\/ \u8fc7\u591a\u7684\u7a7a\u683c<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>x = a &lt; b ? a : b; \/\/ \u826f\u597d\u7684\u98ce\u683c<\/p>\n<p>x=a<br \/>\n<b>&lt;&gt;<\/b><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>int *x = &amp;y; \/\/ \u826f\u597d\u7684\u98ce\u683c<\/p>\n<p>int * x = &amp; y; \/\/ \u4e0d\u826f\u7684\u98ce\u683c<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>array[5] = 0; \/\/ \u4e0d\u8981\u5199\u6210 array [ 5 ] = 0;<\/p>\n<p>a.Function(); \/\/ \u4e0d\u8981\u5199\u6210 a . Function();<\/p>\n<p>b-&gt;Function(); \/\/ \u4e0d\u8981\u5199\u6210 b -&gt;<br \/>\nFunction();<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p align=\"center\">\u793a\u4f8b2-3 \u4ee3\u7801\u884c\u5185\u7684\u7a7a\u683c<\/p>\n<p>\u00a0<\/p>\n<p><strong><font size=\"4\">2.4 \u5bf9\u9f50<\/font><\/strong><\/p>\n<p>\u25cf\u3010\u89c4\u52192-4-1\u3011\u7a0b\u5e8f\u7684\u5206\u754c\u7b26\u2018{\u2019\u548c\u2018}\u2019\u5e94\u72ec\u5360\u4e00\u884c\u5e76\u4e14\u4f4d\u4e8e\u540c\u4e00\u5217\uff0c\u540c\u65f6\u4e0e\u5f15\u7528\u5b83\u4eec\u7684\u8bed\u53e5\u5de6\u5bf9\u9f50\u3002<\/p>\n<p>\u25cf\u3010\u89c4\u52192-4-2\u3011{ }\u4e4b\u5185\u7684\u4ee3\u7801\u5757\u5728\u2018{\u2019\u53f3\u8fb9\u6570\u683c\u5904\u5de6\u5bf9\u9f50\u3002<\/p>\n<table border=\"1\" cellspacing=\"0\" cellpadding=\"8\" width=\"600\" align=\"center\">\n<tbody>\n<tr>\n<td>\n<p>void Function(int x)<\/p>\n<p>{<\/p>\n<p>\u2026 \/\/ program code<\/p>\n<p>}<\/p>\n<\/td>\n<td>\n<p>void Function(int x){<\/p>\n<p>\u2026 \/\/ program code<\/p>\n<p>}<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>if (condition)<\/p>\n<p>{<\/p>\n<p>\u2026 \/\/ program code<\/p>\n<p>}<\/p>\n<p>else<\/p>\n<p>{<\/p>\n<p>\u2026 \/\/ program code<\/p>\n<p>}<\/p>\n<\/td>\n<td>\n<p>if (condition){<\/p>\n<p>\u2026 \/\/ program code<\/p>\n<p>}<\/p>\n<p>else {<\/p>\n<p>\u2026 \/\/ program code<\/p>\n<p>}<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>for (initialization; condition; update)<\/p>\n<p>{<\/p>\n<p>\u2026 \/\/ program code<\/p>\n<p>}<\/p>\n<\/td>\n<td>\n<p>for (initialization; condition; update){<\/p>\n<p>\u2026 \/\/ program code<\/p>\n<p>}<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>While (condition)<\/p>\n<p>{<\/p>\n<p>\u2026 \/\/ program code<\/p>\n<p>}<\/p>\n<\/td>\n<td>\n<p>while (condition){<\/p>\n<p>\u2026 \/\/ program code<\/p>\n<p>}<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>\u5982\u679c\u51fa\u73b0\u5d4c\u5957\u7684\uff5b\uff5d\uff0c\u5219\u4f7f\u7528\u7f29\u8fdb\u5bf9\u9f50\uff0c\u5982\uff1a<\/p>\n<p>{<\/p>\n<p>\n\u00a0\u00a0\u00a0\u00a0\u2026<\/p>\n<p>\n\u00a0\u00a0\u00a0\u00a0{<\/p>\n<p>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u2026<\/p>\n<p>\n\u00a0\u00a0\u00a0\u00a0}<\/p>\n<p>\n\u00a0\u00a0\u00a0\u00a0\u2026<\/p>\n<p>}<\/p>\n<\/td>\n<td>\u00a0<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p align=\"center\">\u793a\u4f8b2-4(a)<br \/>\n\u98ce\u683c\u826f\u597d\u7684\u5bf9\u9f50\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<br \/>\n\u793a\u4f8b2-4(b) \u98ce\u683c\u4e0d\u826f\u7684\u5bf9\u9f50<\/p>\n<p>\u00a0<\/p>\n<p><strong><font size=\"4\">2.5 \u957f\u884c\u62c6\u5206<\/font><\/strong><\/p>\n<p>\u25cf\u3010\u89c4\u52192-5-1\u3011\u4ee3\u7801\u884c\u6700\u5927\u957f\u5ea6\u5b9c\u63a7\u5236\u572870\u81f380\u4e2a\u5b57\u7b26\u4ee5\u5185\u3002\u4ee3\u7801\u884c\u4e0d\u8981\u8fc7\u957f\uff0c\u5426\u5219\u773c\u775b\u770b\u4e0d\u8fc7\u6765\uff0c\u4e5f\u4e0d\u4fbf\u4e8e\u6253\u5370\u3002<\/p>\n<p>\n\u25cf\u3010\u89c4\u52192-5-2\u3011\u957f\u8868\u8fbe\u5f0f\u8981\u5728\u4f4e\u4f18\u5148\u7ea7\u64cd\u4f5c\u7b26\u5904\u62c6\u5206\u6210\u65b0\u884c\uff0c\u64cd\u4f5c\u7b26\u653e\u5728\u65b0\u884c\u4e4b\u9996\uff08\u4ee5\u4fbf\u7a81\u51fa\u64cd\u4f5c\u7b26\uff09\u3002\u62c6\u5206\u51fa\u7684\u65b0\u884c\u8981\u8fdb\u884c\u9002\u5f53\u7684\u7f29\u8fdb\uff0c\u4f7f\u6392\u7248\u6574\u9f50\uff0c\u8bed\u53e5\u53ef\u8bfb\u3002<\/p>\n<table border=\"1\" cellspacing=\"0\" cellpadding=\"8\" width=\"600\" align=\"center\">\n<tbody>\n<tr>\n<td>\n<p>if ((very_longer_variable1 &gt;=<br \/>\nvery_longer_variable12)<\/p>\n<p>\n\u00a0\u00a0\u00a0\u00a0\u00a0&amp;&amp;<br \/>\n(very_longer_variable3 &lt;=<br \/>\nvery_longer_variable14)<\/p>\n<p>\n\u00a0\u00a0\u00a0\u00a0\u00a0&amp;&amp;<br \/>\n(very_longer_variable5 &lt;=<br \/>\nvery_longer_variable16))<\/p>\n<p>{<\/p>\n<p>\n\u00a0\u00a0\u00a0\u00a0\u00a0dosomething();<\/p>\n<p>}<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>virtual CMatrix CMultiplyMatrix (CMatrix leftMatrix,<\/p>\n<p>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0CMatrix<br \/>\nrightMatrix);<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p>for (very_longer_initialization;<\/p>\n<p>\n\u00a0\u00a0\u00a0\u00a0\u00a0very_longer_condition;<\/p>\n<p>\n\u00a0\u00a0\u00a0\u00a0\u00a0very_longer_update)<\/p>\n<p>{<\/p>\n<p>\n\u00a0\u00a0\u00a0\u00a0\u00a0dosomething();<\/p>\n<p>}<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p align=\"center\">\u793a\u4f8b2-5 \u957f\u884c\u7684\u62c6\u5206<\/p>\n<p>\u00a0<\/p>\n<p><strong><font size=\"4\">2.6 \u4fee\u9970\u7b26\u7684\u4f4d\u7f6e<\/font><\/strong><\/p>\n<p>\u4fee\u9970\u7b26 * \u548c \uff06 \u5e94\u8be5\u9760\u8fd1\u6570\u636e\u7c7b\u578b\u8fd8\u662f\u8be5\u9760\u8fd1\u53d8\u91cf\u540d\uff0c\u662f\u4e2a\u6709\u4e89\u8bae\u7684\u6d3b\u9898\u3002<\/p>\n<p>\u82e5\u5c06\u4fee\u9970\u7b26 * \u9760\u8fd1\u6570\u636e\u7c7b\u578b\uff0c\u4f8b\u5982\uff1aint* x; \u4ece\u8bed\u4e49\u4e0a\u8bb2\u6b64\u5199\u6cd5\u6bd4\u8f83\u76f4\u89c2\uff0c\u5373x\u662fint \u7c7b\u578b\u7684\u6307\u9488\u3002<\/p>\n<p>\u4e0a\u8ff0\u5199\u6cd5\u7684\u5f0a\u7aef\u662f\u5bb9\u6613\u5f15\u8d77\u8bef\u89e3\uff0c\u4f8b\u5982\uff1aint* x, y;<br \/>\n\u6b64\u5904y\u5bb9\u6613\u88ab\u8bef\u89e3\u4e3a\u6307\u9488\u53d8\u91cf\u3002\u867d\u7136\u5c06x\u548cy\u5206\u884c\u5b9a\u4e49\u53ef\u4ee5\u907f\u514d\u8bef\u89e3\uff0c\u4f46\u5e76\u4e0d\u662f\u4eba\u4eba\u90fd\u613f\u610f\u8fd9\u6837\u505a\u3002<\/p>\n<p>\u00a0<\/p>\n<p>\u25cf\u3010\u89c4\u52192-6-1\u3011\u5e94\u5f53\u5c06\u4fee\u9970\u7b26 * \u548c \uff06 \u7d27\u9760\u53d8\u91cf\u540d<\/p>\n<p>\u4f8b\u5982\uff1a<\/p>\n<p>char *name;<\/p>\n<p>int *x, y; \/\/ \u6b64\u5904y\u4e0d\u4f1a\u88ab\u8bef\u89e3\u4e3a\u6307\u9488<\/p>\n<p>\u00a0<\/p>\n<p><strong><font size=\"4\">2.7 \u6ce8\u91ca<\/font><\/strong><\/p>\n<p>C\u8bed\u8a00\u7684\u6ce8\u91ca\u7b26\u4e3a\u201c\u201d\u3002C++\u8bed\u8a00\u4e2d\uff0c\u7a0b\u5e8f\u5757\u7684\u6ce8\u91ca\u5e38\u91c7\u7528\u201c\u201d\uff0c\u884c\u6ce8\u91ca\u4e00\u822c\u91c7\u7528\u201c\/\/\u2026\u201d\u3002\u6ce8\u91ca\u901a\u5e38\u7528\u4e8e\uff1a<\/p>\n<p>\uff081\uff09\u7248\u672c\u3001\u7248\u6743\u58f0\u660e\uff1b<\/p>\n<p>\uff082\uff09\u51fd\u6570\u63a5\u53e3\u8bf4\u660e\uff1b<\/p>\n<p>\uff083\uff09\u91cd\u8981\u7684\u4ee3\u7801\u884c\u6216\u6bb5\u843d\u63d0\u793a\u3002<\/p>\n<p>\u867d\u7136\u6ce8\u91ca\u6709\u52a9\u4e8e\u7406\u89e3\u4ee3\u7801\uff0c\u4f46\u6ce8\u610f\u4e0d\u53ef\u8fc7\u591a\u5730\u4f7f\u7528\u6ce8\u91ca\u3002\u53c2\u89c1\u793a\u4f8b2-6\u3002<\/p>\n<p>\u00a0<\/p>\n<p>\n\u25cf\u3010\u89c4\u52192-7-1\u3011\u6ce8\u91ca\u662f\u5bf9\u4ee3\u7801\u7684\u201c\u63d0\u793a\u201d\uff0c\u800c\u4e0d\u662f\u6587\u6863\u3002\u7a0b\u5e8f\u4e2d\u7684\u6ce8\u91ca\u4e0d\u53ef\u55a7\u5bbe\u593a\u4e3b\uff0c\u6ce8\u91ca\u592a\u591a\u4e86\u4f1a\u8ba9\u4eba\u773c\u82b1\u7f2d\u4e71\u3002\u6ce8\u91ca\u7684\u82b1\u6837\u8981\u5c11\u3002<\/p>\n<p>\u25cf\u3010\u89c4\u52192-7-2\u3011\u5982\u679c\u4ee3\u7801\u672c\u6765\u5c31\u662f\u6e05\u695a\u7684\uff0c\u5219\u4e0d\u5fc5\u52a0\u6ce8\u91ca\u3002\u5426\u5219\u591a\u6b64\u4e00\u4e3e\uff0c\u4ee4\u4eba\u538c\u70e6\u3002\u4f8b\u5982<\/p>\n<p>i++; \/\/ i \u52a0 1\uff0c\u591a\u4f59\u7684\u6ce8\u91ca<\/p>\n<p>\u25cf\u3010\u89c4\u52192-7-3\u3011\u8fb9\u5199\u4ee3\u7801\u8fb9\u6ce8\u91ca\uff0c\u4fee\u6539\u4ee3\u7801\u540c\u65f6\u4fee\u6539\u76f8\u5e94\u7684\u6ce8\u91ca\uff0c\u4ee5\u4fdd\u8bc1\u6ce8\u91ca\u4e0e\u4ee3\u7801\u7684\u4e00\u81f4\u6027\u3002\u4e0d\u518d\u6709\u7528\u7684\u6ce8\u91ca\u8981\u5220\u9664\u3002<\/p>\n<p>\u25cf\u3010\u89c4\u52192-7-4\u3011\u6ce8\u91ca\u5e94\u5f53\u51c6\u786e\u3001\u6613\u61c2\uff0c\u9632\u6b62\u6ce8\u91ca\u6709\u4e8c\u4e49\u6027\u3002\u9519\u8bef\u7684\u6ce8\u91ca\u4e0d\u4f46\u65e0\u76ca\u53cd\u800c\u6709\u5bb3\u3002<\/p>\n<p>\u25cf\u3010\u89c4\u52192-7-5\u3011\u5c3d\u91cf\u907f\u514d\u5728\u6ce8\u91ca\u4e2d\u4f7f\u7528\u7f29\u5199\uff0c\u7279\u522b\u662f\u4e0d\u5e38\u7528\u7f29\u5199\u3002<\/p>\n<p>\u25cf\u3010\u89c4\u52192-7-6\u3011\u6ce8\u91ca\u7684\u4f4d\u7f6e\u5e94\u4e0e\u88ab\u63cf\u8ff0\u7684\u4ee3\u7801\u76f8\u90bb\uff0c\u53ef\u4ee5\u653e\u5728\u4ee3\u7801\u7684\u4e0a\u65b9\u6216\u53f3\u65b9\uff0c\u4e0d\u53ef\u653e\u5728\u4e0b\u65b9\u3002<\/p>\n<p>\u25cf\u3010\u89c4\u52192-7-8\u3011\u5f53\u4ee3\u7801\u6bd4\u8f83\u957f\uff0c\u7279\u522b\u662f\u6709\u591a\u91cd\u5d4c\u5957\u65f6\uff0c\u5e94\u5f53\u5728\u4e00\u4e9b\u6bb5\u843d\u7684\u7ed3\u675f\u5904\u52a0\u6ce8\u91ca\uff0c\u4fbf\u4e8e\u9605\u8bfb\u3002<\/p>\n<table border=\"1\" cellspacing=\"0\" cellpadding=\"8\" width=\"600\" align=\"center\">\n<tbody>\n<tr>\n<td>\n<p>\u00a0<\/p>\n<p>void Function(float x, float y, float z)<\/p>\n<p>{<\/p>\n<p>\n\u00a0\u00a0\u00a0\u00a0\u2026<\/p>\n<p>}<\/p>\n<\/td>\n<td>\n<p>if (\u2026)<\/p>\n<p>{<\/p>\n<p>\n\u00a0\u00a0\u00a0\u00a0\u2026<\/p>\n<p>\n\u00a0\u00a0\u00a0\u00a0while<br \/>\n(\u2026)<\/p>\n<p>\n\u00a0\u00a0\u00a0\u00a0{<\/p>\n<p>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u2026<\/p>\n<p>\n\u00a0\u00a0\u00a0\u00a0}<br \/>\n\/\/ end of while<\/p>\n<p>\n\u00a0\u00a0\u00a0\u00a0\u2026<\/p>\n<p>} \/\/ end of if<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p align=\"center\">\u793a\u4f8b2-6 \u7a0b\u5e8f\u7684\u6ce8\u91ca<\/p>\n<p>\u00a0<\/p>\n<p><strong><font size=\"4\">2.8 \u7c7b\u7684\u7248\u5f0f<\/font><\/strong><\/p>\n<p>\n\u7c7b\u53ef\u4ee5\u5c06\u6570\u636e\u548c\u51fd\u6570\u5c01\u88c5\u5728\u4e00\u8d77\uff0c\u5176\u4e2d\u51fd\u6570\u8868\u793a\u4e86\u7c7b\u7684\u884c\u4e3a\uff08\u6216\u79f0\u670d\u52a1\uff09\u3002\u7c7b\u63d0\u4f9b\u5173\u952e\u5b57public\u3001protected\u548cprivate\uff0c\u5206\u522b\u7528\u4e8e\u58f0\u660e\u54ea\u4e9b\u6570\u636e\u548c\u51fd\u6570\u662f\u516c\u6709\u7684\u3001\u53d7\u4fdd\u62a4\u7684\u6216\u8005\u662f\u79c1\u6709\u7684\u3002\u8fd9\u6837\u53ef\u4ee5\u8fbe\u5230\u4fe1\u606f\u9690\u85cf\u7684\u76ee\u7684\uff0c\u5373\u8ba9\u7c7b\u4ec5\u4ec5\u516c\u5f00\u5fc5\u987b\u8981\u8ba9\u5916\u754c\u77e5\u9053\u7684\u5185\u5bb9\uff0c\u800c\u9690\u85cf\u5176\u5b83\u4e00\u5207\u5185\u5bb9\u3002\u6211\u4eec\u4e0d\u53ef\u4ee5\u6ee5\u7528\u7c7b\u7684\u5c01\u88c5\u529f\u80fd\uff0c\u4e0d\u8981\u628a\u5b83\u5f53\u6210\u706b\u9505\uff0c\u4ec0\u4e48\u4e1c\u897f\u90fd\u5f80\u91cc\u6254\u3002<\/p>\n<p>\u7c7b\u7684\u7248\u5f0f\u4e3b\u8981\u6709\u4e24\u79cd\u65b9\u5f0f\uff1a<\/p>\n<p>\n\uff081\uff09\u5c06private\u7c7b\u578b\u7684\u6570\u636e\u5199\u5728\u524d\u9762\uff0c\u800c\u5c06public\u7c7b\u578b\u7684\u51fd\u6570\u5199\u5728\u540e\u9762\uff0c\u5982\u793a\u4f8b8-3\uff08a\uff09\u3002\u91c7\u7528\u8fd9\u79cd\u7248\u5f0f\u7684\u7a0b\u5e8f\u5458\u4e3b\u5f20\u7c7b\u7684\u8bbe\u8ba1\u201c\u4ee5\u6570\u636e\u4e3a\u4e2d\u5fc3\u201d\uff0c\u91cd\u70b9\u5173\u6ce8\u7c7b\u7684\u5185\u90e8\u7ed3\u6784\u3002<\/p>\n<p>\n\uff082\uff09\u5c06public\u7c7b\u578b\u7684\u51fd\u6570\u5199\u5728\u524d\u9762\uff0c\u800c\u5c06private\u7c7b\u578b\u7684\u6570\u636e\u5199\u5728\u540e\u9762\uff0c\u5982\u793a\u4f8b8.3\uff08b\uff09\u91c7\u7528\u8fd9\u79cd\u7248\u5f0f\u7684\u7a0b\u5e8f\u5458\u4e3b\u5f20\u7c7b\u7684\u8bbe\u8ba1\u201c\u4ee5\u884c\u4e3a\u4e3a\u4e2d\u5fc3\u201d\uff0c\u91cd\u70b9\u5173\u6ce8\u7684\u662f\u7c7b\u5e94\u8be5\u63d0\u4f9b\u4ec0\u4e48\u6837\u7684\u63a5\u53e3\uff08\u6216\u670d\u52a1\uff09\u3002<\/p>\n<p>\u5f88\u591aC++\u6559\u8bfe\u4e66\u53d7\u5230Biarne<br \/>\nStroustrup\u7b2c\u4e00\u672c\u8457\u4f5c\u7684\u5f71\u54cd\uff0c\u4e0d\u77e5\u4e0d\u89c9\u5730\u91c7\u7528\u4e86\u201c\u4ee5\u6570\u636e\u4e3a\u4e2d\u5fc3\u201d\u7684\u4e66\u5199\u65b9\u5f0f\uff0c\u5e76\u4e0d\u89c1\u5f97\u6709\u591a\u5c11\u9053\u7406\u3002<\/p>\n<p>\n\u6211\u5efa\u8bae\u8bfb\u8005\u91c7\u7528\u201c\u4ee5\u884c\u4e3a\u4e3a\u4e2d\u5fc3\u201d\u7684\u4e66\u5199\u65b9\u5f0f\uff0c\u5373\u9996\u5148\u8003\u8651\u7c7b\u5e94\u8be5\u63d0\u4f9b\u4ec0\u4e48\u6837\u7684\u51fd\u6570\u3002\u8fd9\u662f\u5f88\u591a\u4eba\u7684\u7ecf\u9a8c\u2014\u2014\u201c\u8fd9\u6837\u505a\u4e0d\u4ec5\u8ba9\u81ea\u5df1\u5728\u8bbe\u8ba1\u7c7b\u65f6\u601d\u8def\u6e05\u6670\uff0c\u800c\u4e14\u65b9\u4fbf\u522b\u4eba\u9605\u8bfb\u3002\u56e0\u4e3a\u7528\u6237\u6700\u5173\u5fc3\u7684\u662f\u63a5\u53e3\uff0c\u8c01\u613f\u610f\u5148\u770b\u5230\u4e00\u5806\u79c1\u6709\u6570\u636e\u6210\u5458\uff01\u201d<\/p>\n<table border=\"1\" cellspacing=\"0\" cellpadding=\"8\" width=\"600\" align=\"center\">\n<tbody>\n<tr>\n<td>\n<p>class A<\/p>\n<p>{<\/p>\n<p>private:<\/p>\n<p>int i, j;<\/p>\n<p>float x, y;<\/p>\n<p>\u2026<\/p>\n<p>public:<\/p>\n<p>void Func1(void);<\/p>\n<p>void Func2(void);<\/p>\n<p>\u2026<\/p>\n<p>}<\/p>\n<\/td>\n<td>\n<p>class A<\/p>\n<p>{<\/p>\n<p>public:<\/p>\n<p>void Func1(void);<\/p>\n<p>void Func2(void);<\/p>\n<p>\u2026<\/p>\n<p>private:<\/p>\n<p>int i, j;<\/p>\n<p>float x, y;<\/p>\n<p>\u2026<\/p>\n<p>}<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p align=\"center\">\u793a\u4f8b8.3(a) \u4ee5\u6570\u636e\u4e3a\u4e2d\u5fc3\u7248\u5f0f<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u793a\u4f8b8.3(b)<br \/>\n\u4ee5\u884c\u4e3a\u4e3a\u4e2d\u5fc3\u7684\u7248\u5f0f<\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u9ad8\u8d28\u91cfC++\u6559\u7a0b &#8212; \u7b2c2\u7ae0 \u7a0b\u5e8f\u7684\u7248\u5f0f \u6765\u6e90:www.vcworld.net\u3000 \u7248\u5f0f\u867d\u7136\u4e0d\u4f1a\u5f71\u54cd\u7a0b\u5e8f\u7684\u529f\u80fd &hellip; <a href=\"https:\/\/www.keyboardmeow.com\/?p=30\" class=\"more-link\">\u7ee7\u7eed\u9605\u8bfb<span class=\"screen-reader-text\">\u201c\u9ad8\u8d28\u91cfC++\u6559\u7a0b &#8212; \u7b2c2\u7ae0 \u7a0b\u5e8f\u7684\u7248\u5f0f\u201d<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[15],"tags":[76,81,83,137,40,39],"class_list":["post-30","post","type-post","status-publish","format-standard","hentry","category-c","tag-for","tag-if","tag-it","tag-137","tag-40","tag-39"],"_links":{"self":[{"href":"https:\/\/www.keyboardmeow.com\/index.php?rest_route=\/wp\/v2\/posts\/30","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.keyboardmeow.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.keyboardmeow.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.keyboardmeow.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.keyboardmeow.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=30"}],"version-history":[{"count":0,"href":"https:\/\/www.keyboardmeow.com\/index.php?rest_route=\/wp\/v2\/posts\/30\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.keyboardmeow.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=30"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.keyboardmeow.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=30"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.keyboardmeow.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=30"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}