{"id":2700,"date":"2015-07-16T14:31:07","date_gmt":"2015-07-16T06:31:07","guid":{"rendered":"http:\/\/blog.qdac.cc\/?p=2700"},"modified":"2015-07-16T14:31:07","modified_gmt":"2015-07-16T06:31:07","slug":"%e6%95%99%e7%a8%8b-%e4%b8%80%e4%b8%aa%e7%a8%8b%e5%ba%8f%e7%9a%84%e5%9f%ba%e6%9c%ac%e9%80%bb%e8%be%91","status":"publish","type":"post","link":"https:\/\/blog.qdac.cc\/?p=2700","title":{"rendered":"[\u6559\u7a0b] \u4e00\u4e2a\u7a0b\u5e8f\u7684\u57fa\u672c\u903b\u8f91"},"content":{"rendered":"<p>\u9996\u5148\uff0c\u4ec0\u4e48\u662f\u7a0b\u5e8f\uff1f<\/p>\n<p>\u7a0b\u5e8f\u5b9e\u9645\u4e0a\u662f\u4e00\u5806\u547d\u4ee4\u548c\u903b\u8f91\u5224\u65ad\u7684\u7ec4\u5408\uff0c\u5c31\u8c61\u6211\u4eec\u8bf4\u8bdd\uff0c\u53ea\u662f\u8bcd\u6c47\u548c\u903b\u8f91\u5224\u65ad\u7684\u7ec4\u5408\u4e00\u6837\u3002\u6211\u4eec\u4eba\u8bf4\u8bdd\u6700\u57fa\u672c\u7684\u662f\u62fc\u97f3\uff0c\u7136\u540e\u4e0d\u540c\u7684\u8bfb\u97f3\u7684\u5b57\u7b26\u62fc\u5728\u4e00\u8d77\uff0c\u5f62\u6210\u903b\u8f91\u4e0a\u5408\u7406\u7684\u4e00\u53e5\u8bdd\u3002\u800c\u8ba1\u7b97\u673a\u6700\u57fa\u672c\u7684\u90e8\u5206\u88ab\u79f0\u4e3a\u5173\u952e\u8bcd\uff0c\u7136\u540e\u5c06\u8fd9\u4e9b\u5173\u952e\u8bcd\u62fc\u5728\u4e00\u8d77\uff0c\u5f62\u6210\u903b\u8f91\u4e0a\u5408\u7406\u7684\u4e00\u53e5\u547d\u4ee4\u64cd\u4f5c\u3002\u6211\u4eec\u6765\u770b\u770b\u57fa\u672c\u7684\u5173\u952e\u8bcd\uff1a<\/p>\n<ul>\n<li>\u4ea4\u4ed8<br \/>\n\u6211\u4eec\u751f\u6d3b\u4e2d\u5c06\u4e00\u4e2a\u4e1c\u897f\u7ed9\u53e6\u4e00\u4e2a\u4eba\u7684\u8fc7\u7a0b\uff0c\u5c31\u662f\u4e00\u4e2a\u4ea4\u4ed8\u7684\u8fc7\u7a0b\u3002\u8ba1\u7b97\u673a\u4e2d\uff0c\u5c06\u4e00\u4e2a\u503c\u4ea4\u4ed8\u7ed9\u4e00\u4e2a\u53d8\u91cf\u5b58\u8d2e\u7684\u8fc7\u7a0b\uff0c\u4e5f\u662f\u4e00\u79cd\u4ea4\u4ed8\uff0c\u6211\u4eec\u79f0\u4e4b\u4e3a\u8d4b\u503c\u3002\u800c\u8d4b\u503c\u7684\u8bed\u53e5\u5728\u4e0d\u540c\u7684\u8bed\u8a00\u91cc\u662f\u4e0d\u4e00\u6837\u7684\uff0c\u5c31\u8c61\u4f60\u53ef\u4ee5\u7528\u5de6\u624b\u4ea4\u4ed8\uff0c\u4e5f\u53ef\u4ee5\u53f3\u624b\uff0c\u8fd8\u53ef\u4ee5\u53cc\u624b\u4ea4\u4ed8\u4e00\u6837\u3002\u5927\u6982\u4e86\u89e3\u4e0b\uff1a<\/p>\n<pre class=\"lang:delphi decode:true \">a := 100;<\/pre>\n<pre class=\"lang:c++ decode:true\">a = 100;<\/pre>\n<p>\u7b2c\u4e00\u79cd\u662f Pascal \u6216 Go \u8bed\u8a00\u91cc\u8d4b\u503c\u7684\u5199\u6cd5\uff0c\u800c\u4e0b\u9762\u662f\u5176\u5b83\u8bed\u8a00\u5e38\u89c1\u7684\u8d4b\u503c\u8bed\u53e5\u5199\u6cd5\u3002\u4e0d\u7ba1\u600e\u4e48\u6837\uff0c\u4f60\u8981\u77e5\u9053\u8fd9\u53e5\u8bdd\u7684\u610f\u601d\u662f\u5c06 100 \u8d4b\u503c a \u3002<\/li>\n<li>\u5224\u65ad<br \/>\n\u6211\u4eec\u5728\u5916\u9762\u8981\u4e0a\u5395\u6240\uff0c\u5b9e\u9645\u4e0a\u6211\u4eec\u5c31\u505a\u4e86\u5f88\u591a\u5224\u65ad\uff0c\u9996\u5148\uff0c\u6211\u4eec\u8981\u5224\u65ad\u662f\u4e0d\u662f\u5395\u6240\uff0c\u597d\u4e86\uff0c\u662f\u5395\u6240\uff0c\u90a3\u4e48\u6211\u4eec\u9700\u8981\u5224\u65ad\u8fd9\u4e2a\u5395\u6240\u662f\u7537\u5395\u6240\u8fd8\u662f\u5973\u5395\u6240\uff0c\u8fd8\u662f\u4e0d\u5206\u7537\u5973\u7684\u5c01\u95ed\u5395\u6240\uff0c\u7136\u540e\u6211\u4eec\u5c31\u9700\u8981\u6839\u636e\u81ea\u5df1\u7684\u6027\u522b\u6765\u505a\u4e00\u4e2a\u5224\u65ad\uff0c\u6211\u8be5\u4e0a\u90a3\u4e2a\u5395\u6240\u3002\u7a0b\u5e8f\u91cc\u4e5f\u662f\u4e00\u6837\u5b58\u5728\u5404\u79cd\u5404\u6837\u7684\u5224\u65ad\uff0c\u8fd9\u5757\u7684\u8bed\u6cd5\u4e0d\u540c\u7684\u8bed\u8a00\u5927\u540c\u5c0f\u5f02\uff0c\u770b\u770b\u4e0b\u9762\u7684\u51e0\u4e2a\u5199\u6cd5\uff1a<\/p>\n<pre class=\"lang:c++ decode:true\">if ( a &gt; 100 )\r\n  a=a+10;\r\nelse if ( a &lt; 10 )\r\n  a=a-100;\r\nelse\r\n  a=0;<\/pre>\n<pre class=\"lang:delphi decode:true \">if  a &gt; 100  then\r\n  a:=a+10\r\nelse if a &lt; 10 then\r\n  a:=a-100\r\nelse\r\n  a:=0;<\/pre>\n<pre class=\"lang:delphi decode:true \">if  a &gt; 100 then\r\n  a=a+10\r\nelse if  a &lt; 10 then\r\n  a=a-100\r\nelse\r\n  a=0\r\nend if<\/pre>\n<p>\u597d\u5427\uff0c\u5148\u5217\u51fa\u4e0a\u9762\u4e09\u79cd\uff0c\u8fd8\u6709\u7684\u8bed\u5c06\u5c06 end if \u8fde\u5728\u4e00\u8d77\u5199\uff0c\u8fd8\u6709\u7684\u8981\u6c42\u7684\u662f ifend \u6216 if end \u800c\u4e0d\u662f end if\uff0c\u4f46\u57fa\u672c\u7684\u903b\u8f91\u90fd\u662f\uff1a\u5982\u679c\u600e\u4e48\u6837\uff0c\u90a3\u4e48\u600e\u4e48\u6837\uff0c\u5426\u5219\u5982\u679c\u600e\u4e48\u6837\u5c31\u600e\u4e48\u6837\uff0c\u5426\u5219\u600e\u4e48\u6837\u7684\u903b\u8f91\u3002<br \/>\n\u4e0a\u9762\u7528\u4e00\u5806 if \/else if \/ else \u7684\u7ec4\u5408\uff0c\u6709\u65f6\u611f\u89c9\u5199\u7740\u9ebb\u70e6\uff0c\u4e8e\u662f\u4eba\u4eec\u5c31\u521b\u5efa\u51fa\u4e86\u5206\u652f\u9009\u62e9\u8bed\u53e5\uff0cC \/ C++ \u7b49\u8bed\u8a00\u91cc\u662f switch \/ case \u00a0\u8bed\u53e5\uff0c\u800c\u00a0Pascal \u91cc\u662f case \u8bed\u53e5\uff0c\u5148\u4e0d\u8be6\u89e3\uff0c\u7b80\u5355\u4e86\u89e3\u3002<\/li>\n<li>\u8df3\u8f6c<br \/>\n\u8ba1\u7b97\u673a\u91cc\uff0c\u6b63\u5e38\u60c5\u51b5\u4e0b\uff0c\u547d\u4ee4\u662f\u987a\u5e8f\u6267\u884c\u7684\uff0c\u4e5f\u5c31\u662f\u8bf4\u5148\u6267\u884c\u5b8c\u7b2c\u4e00\u53e5\u518d\u6267\u884c\u7b2c\u4e8c\u53e5\uff0c\u4f9d\u6b21\u5f80\u4e0b\u8d70\uff0c\u8d70\u5230\u5934\uff0c\u7a0b\u5e8f\u5c31\u7ed3\u675f\u4e86\u3002\u4f46\u8bb8\u591a\u65f6\u5019\uff0c\u6211\u4eec\u8981\u91cd\u590d\u6267\u884c\u64cd\u4f5c\u600e\u4e48\u529e\uff1f\u90a3\u5c31\u7275\u6d89\u5230\u8df3\u8f6c\u3002<br \/>\n\u8ba1\u7b97\u673a\u91cc\uff0c\u8df3\u8f6c\u8bed\u53e5\u7684\u8001\u7956\u5b97\u53eb\u4f5c goto \uff0c\u540e\u9762\u8ddf\u8981\u8df3\u8f6c\u7684\u76ee\u6807\u6807\u7b7e\u540d\u79f0\u3002\u6362\u53e5\u8bdd\u8bf4\uff0c\u5c31\u662f\u5148\u5b9a\u4e49\u4e00\u4e2a\u6807\u7b7e\uff0c\u5047\u8bbe\u53eb a\uff0c\u7136\u540e\u518d\u7528 goto a \u8df3\u8f6c\u5230 a \u8fd9\u4e2a\u4f4d\u7f6e\u4ece a \u8fd9\u4e2a\u6807\u7b7e\u6240\u5728\u7684\u4f4d\u7f6e\u5f00\u59cb\u6267\u884c\u3002\u81f3\u4e8e\u6807\u7b7e\u7684\u5199\u6cd5\uff0c\u4e0d\u540c\u7684\u8bed\u8a00\u53c8\u4e0d\u4e00\u6837\uff0cC++ \u91cc\u662f\u7528 \u201c\u6807\u7b7e:\u201d \u6765\u6807\u8bb0\u7684\uff0c\u770b\u4e0b\u9762\u7684\u4f8b\u5b50\uff1a<\/p>\n<pre class=\"lang:delphi decode:true\">a:\r\n...\r\ngoto a;\r\n<\/pre>\n<p>\u7531\u4e8e a \u5728 goto \u7684\u524d\u9762\uff0c\u5c31\u5f62\u6210\u4e86\u4e00\u4e2a\u4e0d\u65ad\u91cd\u590d\u6267\u884c\u7684\u903b\u8f91\uff0c\u6211\u4eec\u79f0\u4e4b\u4e3a\u5faa\u73af\uff08 loop \uff09\u3002\u53cd\u8fc7\u6765\uff0c\u5982\u679c a \u5728 goto \u7684\u540e\u9762\uff0c\u5c31\u662f\u76f4\u63a5\u7684\u8df3\u8f6c\u4e86\u3002<\/p>\n<pre class=\"lang:delphi decode:true \">goto a;\r\n...\r\na:<\/pre>\n<p>\u5f53\u7a0b\u5e8f\u6267\u884c\u5230 goto a \u65f6\uff0c\u4e2d\u95f4\u7701\u7565\u53f7\u7684\u4ee3\u7801\u5c31\u88ab\u5b8c\u5168\u8df3\u8fc7\u53bb\uff0c\u5b8c\u5168\u65e0\u89c6\u4e86:)\u3002<\/p>\n<p>\u8df3\u6765\u8df3\u53bb\uff0c\u662f\u4e0d\u662f\u5f88\u597d\u73a9\uff1f\u4f46\u662f\u8fd9\u6837\u8df3\u6765\u8df3\u53bb\u770b\u8d77\u6765\u5f88\u597d\u73a9\uff0c\u4f46\u7a0b\u5e8f\u4e00\u65e6\u4ee3\u7801\u91cf\u4e0a\u6765\uff0c\u5c31\u53d8\u5f97\u4e0d\u597d\u73a9\u4e86\uff0c\u4ee3\u7801\u7684\u9605\u8bfb\u548c\u7406\u89e3\u5c31\u4ea7\u751f\u4e86\u56f0\u96be\uff0c\u4e8e\u662f\u4eba\u4eec\u521b\u9020\u4e86\u4e00\u4e9b\u4e13\u7528\u7684\u5faa\u73af\u63a7\u5236\u8bed\u53e5\uff0c\u5982 while \/ for \/ repeat..until \u7b49\u7b49\u6765\u589e\u52a0\u4ee3\u7801\u7684\u53ef\u8bfb\u6027\uff0c\u5e76\u547d\u540d\u4e3a\u7ed3\u6784\u5316\u7f16\u7a0b\uff0c\u4f46\u6ca1\u6709\u4e00\u79cd\u63a7\u5236\u80fd\u4e0e goto \u7684\u7075\u6d3b\u6027\u76f8\u6bd4\uff0c\u6240\u4ee5\uff0c\u867d\u7136\u8fc7\u53bb\u8fd9\u4e48\u591a\u5e74\u4e86\uff0c\u4eba\u4eec\u4e00\u76f4\u907f\u514d\u7528 goto \u8bed\u53e5\u6765\u7f16\u7801\uff0c\u4f46\u6709\u65f6\u5019\uff0cgoto \u7684\u4ef7\u503c\u5374\u662f\u65e0\u53ef\u66ff\u4ee3\u7684\u3002<br \/>\n\u5728\u8fd9\u91cc\uff0c\u6211\u4eec\u9700\u8981\u77e5\u9053\uff0c\u5faa\u73af\u5b9e\u9645\u4e0a\u662f\u4e00\u79cd\u8df3\u8f6c\u3002\u4e0a\u9762\u7684\u903b\u8f91\u5224\u65ad\u8bed\u53e5\uff0c\u5b9e\u9645\u4e0a\u4e5f\u662f\u4e00\u79cd\u5206\u652f\u8df3\u8f6c\uff0c\u4f60\u53ef\u4ee5\u60f3\u4e00\u4e0b\u4e3a\u4ec0\u4e48\uff1f<\/li>\n<li>\u8fd0\u7b97<br \/>\n\u7a0b\u5e8f\u672c\u8d28\u4e0a\u5c31\u662f\u5bf9\u6570\u636e\u7684\u5904\u7406\u8fc7\u7a0b\uff0c\u53ef\u4ee5\u5904\u7406\u5bf9\uff0c\u4e5f\u53ef\u4ee5\u5904\u7406\u9519\uff08 \u7a0b\u5e8f\u7684 Bug \uff09\u3002\u800c\u5904\u7406\u7684\u8fc7\u7a0b\u5c31\u662f\u8fd0\u7b97\uff0c\u8fd0\u884c\u5c31\u7275\u6d89\u5230\u5982\u679c\u5b9a\u4e49\u8fd0\u7b97\u7684\u89c4\u5219\uff0c\u8fd9\u5c31\u662f\u6240\u8c13\u7684\u8868\u8fbe\u5f0f\u4e86\u3002<br \/>\n\u8868\u8fbe\u5f0f\u5206\u4e3a\u6570\u5b66\u8868\u8fbe\u5f0f\u548c\u903b\u8f91\u8868\u8fbe\u5f0f\u4e24\u79cd\uff0c\u6570\u5b66\u8868\u8fbe\u5f0f\u597d\u8bf4\u4e86\uff0c\u4e0d\u5916\u4e4e\u6211\u4eec\u65e5\u5e38\u5b66\u5230\u7684\u52a0\u3001\u51cf\u3001\u4e58\u3001\u9664\u3001\u6c42\u4f59\u7b49\u6570\u5b66\u8fd0\u7b97\u7b26\u4ee5\u53ca\u62ec\u53f7\uff0c\u53e6\u5916\u5c31\u662f\u52a0\u5165\u4e86\u8ba1\u7b97\u673a\u7279\u6709\u7684\u4f4d\u8fd0\u7b97\u3002\u903b\u8f91\u8868\u8fbe\u5f0f\u6709\u4e09\u79cd\uff1a\u4e0e\u3001\u6216\u3001\u975e\u3002\u4e0e\u5c31\u662f\u6211\u4eec\u8bf4\u7684\u5e76\u4e14\u5173\u7cfb\uff0c\u4e24\u4e2a\u6761\u4ef6\u540c\u65f6\u6210\u7acb\u624d\u6210\u7acb\uff0c\u6216\u7684\u8bdd\uff0c\u6709\u4e00\u4e2a\u6761\u4ef6\u6210\u7acb\u5373\u6210\u7acb\uff0c\u975e\u5219\u662f\u53ea\u9488\u5bf9\u4e00\u4e2a\u6761\u4ef6\u6765\u7684\uff0c\u5373\u8fd9\u4e2a\u6761\u4ef6\u4e0d\u6210\u7acb\u65f6\u624d\u6210\u7acb\u3002<\/li>\n<li>\u5165\u53e3<br \/>\n\u4e0a\u9762\u8bf4\u4e86\u4e00\u5806\uff0c\u6240\u8c13\u4e07\u4e8b\u603b\u6709\u5934\uff0c\u7a0b\u5e8f\u8981\u6267\u884c\u4e5f\u5f97\u6709\u4e2a\u5934\uff0c\u4ece\u90a3\u513f\u5f00\u59cb\u6267\u884c\u3002\u8fd9\u4e2a\u5c31\u53eb\u5165\u53e3\u51fd\u6570\uff0c\u5728 C \/ C++\uff0c\u8fd9\u4e2a\u51fd\u6570\u53eb\u505a main\uff0c\u5176\u5b83\u8bed\u8a00\u6216\u8005\u73af\u5883\u53ef\u80fd\u4f1a\u6709\u6240\u4e0d\u540c\uff0c\u4f46\u80af\u5b9a\u6709\u4e00\u4e2a\u5165\u53e3\u3002<\/li>\n<\/ul>\n<p>\u597d\u4e86\uff0c\u672c\u6587\u662f\u4e00\u4e2a\u603b\u4f53\u4e0a\u7684\u8bb2\u89e3\uff0c\u66f4\u8be6\u7ec6\u7684\u5185\u5bb9\u9700\u8981\u4e00\u6b65\u6b65\u6765\u3002\u5148\u6709\u5927\u6846\uff0c\u7136\u540e\u5c31\u662f\u4e00\u6b65\u6b65\u7ec6\u5316\u7684\u95ee\u9898\u4e86\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u9996\u5148\uff0c\u4ec0\u4e48\u662f\u7a0b\u5e8f\uff1f \u7a0b\u5e8f\u5b9e\u9645\u4e0a\u662f\u4e00\u5806\u547d\u4ee4 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[21],"tags":[],"class_list":["post-2700","post","type-post","status-publish","format-standard","hentry","category-misc"],"views":2638,"_links":{"self":[{"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/posts\/2700","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2700"}],"version-history":[{"count":1,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/posts\/2700\/revisions"}],"predecessor-version":[{"id":2701,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/posts\/2700\/revisions\/2701"}],"wp:attachment":[{"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2700"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2700"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2700"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}