{"id":76535,"date":"2024-01-01T17:53:10","date_gmt":"2024-01-01T09:53:10","guid":{"rendered":"https:\/\/www.techphant.cn\/?p=76535"},"modified":"2024-01-01T17:53:10","modified_gmt":"2024-01-01T09:53:10","slug":"cxdkzjgjqzy","status":"publish","type":"post","link":"https:\/\/www.techphant.cn\/blog\/76535.html","title":{"rendered":"\u7a0b\u5e8f\u7684\u63a7\u5236\u7ed3\u6784\u53ca\u5176\u4f5c\u7528"},"content":{"rendered":"
\u7a0b\u5e8f\u7684\u63a7\u5236\u7ed3\u6784\u662f\u7f16\u7a0b\u4e2d\u7684\u6838\u5fc3\u5173\u952e\u8bcd\u4e4b\u4e00\uff0c\u5305\u62ec\u987a\u5e8f\u7ed3\u6784\u3001\u9009\u62e9\u7ed3\u6784\u548c\u5faa\u73af\u7ed3\u6784\u3002\u638c\u63e1\u7a0b\u5e8f\u7684\u63a7\u5236\u7ed3\u6784\u662f\u7f16\u7a0b\u80fd\u529b\u7684\u91cd\u8981\u7ec4\u6210\u90e8\u5206\uff0c\u4e5f\u662f\u5b9e\u73b0\u5404\u79cd\u7b97\u6cd5\u548c\u903b\u8f91\u529f\u80fd\u7684\u5173\u952e\u3002\u672c\u6587\u4ecb\u7ecd\u4e86\u7a0b\u5e8f\u7684\u63a7\u5236\u7ed3\u6784\u7684\u4f5c\u7528\u53ca\u5e94\u7528\u3002<\/p>\n
\u987a\u5e8f\u7ed3\u6784\u662f\u7a0b\u5e8f\u4e2d\u6700\u57fa\u672c\u7684\u7ed3\u6784\uff0c\u6307\u7684\u662f\u6309\u7167\u987a\u5e8f\u9010\u884c\u6267\u884c\u4ee3\u7801\u3002\u8fd9\u79cd\u7ed3\u6784\u7b80\u5355\u76f4\u63a5\uff0c\u4ee3\u7801\u6309\u7167\u4e66\u5199\u987a\u5e8f\u4f9d\u6b21\u6267\u884c\uff0c\u662f\u7a0b\u5e8f\u6267\u884c\u7684\u9ed8\u8ba4\u72b6\u6001\u3002\u987a\u5e8f\u7ed3\u6784\u80fd\u591f\u5b9e\u73b0\u7b80\u5355\u7684\u903b\u8f91\u548c\u7b97\u6cd5\uff0c\u662f\u7f16\u7a0b\u4e2d\u6700\u5e38\u7528\u7684\u7ed3\u6784\u4e4b\u4e00\u3002<\/p>\n
\u4ee5\u4e0b\u662f\u4e00\u4e2a\u7b80\u5355\u7684\u987a\u5e8f\u7ed3\u6784\u7684\u793a\u4f8b\u4ee3\u7801\uff1a<\/p>\n
int a = 5;<\/p>
int b = 3;<\/p>
int c = a + b;<\/p><\/code><\/pre>\n
\u9009\u62e9\u7ed3\u6784<\/h2>\n
\u9009\u62e9\u7ed3\u6784\u5141\u8bb8\u7a0b\u5e8f\u6839\u636e\u6761\u4ef6\u7684\u771f\u5047\u9009\u62e9\u6267\u884c\u4e0d\u540c\u7684\u4ee3\u7801\u5757\u3002\u5e38\u89c1\u7684\u9009\u62e9\u7ed3\u6784\u6709if\u8bed\u53e5\u3001switch\u8bed\u53e5\u7b49\u3002\u9009\u62e9\u7ed3\u6784\u80fd\u591f\u5b9e\u73b0\u6839\u636e\u4e0d\u540c\u60c5\u51b5\u6267\u884c\u4e0d\u540c\u7684\u903b\u8f91\uff0c\u662f\u7a0b\u5e8f\u4e2d\u5e38\u7528\u7684\u63a7\u5236\u7ed3\u6784\u4e4b\u4e00\u3002<\/p>\n
if\u8bed\u53e5<\/h3>\n
if\u8bed\u53e5\u662f\u5b9e\u73b0\u6761\u4ef6\u9009\u62e9\u7684\u5e38\u7528\u7ed3\u6784\uff0c\u53ef\u4ee5\u6839\u636e\u6761\u4ef6\u7684\u771f\u5047\u6267\u884c\u4e0d\u540c\u7684\u4ee3\u7801\u5757\u3002<\/p>\n
\u4ee3\u7801\u793a\u4f8b<\/h4>\n if (x > 10) {<\/p>
\/\/ do something<\/p>
} else {<\/p>
\/\/ do something else<\/p>
}<\/p><\/code><\/pre>\n
\u5faa\u73af\u7ed3\u6784<\/h2>\n
\u5faa\u73af\u7ed3\u6784\u5141\u8bb8\u7a0b\u5e8f\u91cd\u590d\u6267\u884c\u67d0\u4e00\u6bb5\u4ee3\u7801\uff0c\u76f4\u5230\u6ee1\u8db3\u9000\u51fa\u5faa\u73af\u7684\u6761\u4ef6\u3002\u5e38\u89c1\u7684\u5faa\u73af\u7ed3\u6784\u6709for\u5faa\u73af\u3001while\u5faa\u73af\u7b49\u3002\u5faa\u73af\u7ed3\u6784\u80fd\u591f\u5b9e\u73b0\u91cd\u590d\u6267\u884c\u7684\u903b\u8f91\uff0c\u63d0\u9ad8\u4e86\u7f16\u7a0b\u6548\u7387\u548c\u7075\u6d3b\u6027\u3002<\/p>\n
for\u5faa\u73af<\/h3>\n
for\u5faa\u73af\u662f\u4e00\u79cd\u5e38\u89c1\u7684\u5faa\u73af\u7ed3\u6784\uff0c\u901a\u8fc7\u63a7\u5236\u5faa\u73af\u53d8\u91cf\u7684\u53d6\u503c\u8303\u56f4\u6765\u91cd\u590d\u6267\u884c\u4ee3\u7801\u5757\u3002<\/p>\n
\u4ee3\u7801\u793a\u4f8b<\/h4>\n for (int i = 0; i < 10; i++) {<\/p>
\/\/ do something<\/p>
}<\/p><\/code><\/pre>\n
\u603b\u7ed3<\/h2>\n
\u7a0b\u5e8f\u7684\u63a7\u5236\u7ed3\u6784\u5305\u62ec\u987a\u5e8f\u7ed3\u6784\u3001\u9009\u62e9\u7ed3\u6784\u548c\u5faa\u73af\u7ed3\u6784\uff0c\u901a\u8fc7\u8fd9\u4e9b\u7ed3\u6784\u53ef\u4ee5\u5b9e\u73b0\u590d\u6742\u7684\u903b\u8f91\u548c\u7b97\u6cd5\u3002<\/strong>\u638c\u63e1\u8fd9\u4e9b\u63a7\u5236\u7ed3\u6784\u5e76\u7075\u6d3b\u8fd0\u7528\uff0c\u80fd\u591f\u63d0\u9ad8\u7f16\u7a0b\u6548\u7387\uff0c\u5b9e\u73b0\u5404\u79cd\u5b9e\u9645\u9700\u6c42\u3002\u7f16\u7a0b\u5b66\u4e60\u8005\u5e94\u8be5\u6df1\u5165\u7406\u89e3\u8fd9\u4e9b\u63a7\u5236\u7ed3\u6784\u7684\u539f\u7406\u548c\u5e94\u7528\uff0c\u4ee5\u63d0\u5347\u81ea\u5df1\u7684\u7f16\u7a0b\u80fd\u529b\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u7a0b\u5e8f\u7684\u63a7\u5236\u7ed3\u6784\u662f\u7f16\u7a0b\u4e2d\u7684\u6838\u5fc3\u5173\u952e\u8bcd\u4e4b\u4e00\uff0c\u5305\u62ec\u987a\u5e8f\u7ed3\u6784\u3001\u9009\u62e9\u7ed3\u6784\u548c\u5faa\u73af\u7ed3\u6784\u3002\u638c\u63e1\u7a0b\u5e8f\u7684\u63a7\u5236\u7ed3\u6784\u662f\u7f16\u7a0b\u80fd\u529b\u7684\u91cd\u8981\u7ec4\u6210\u90e8\u5206\uff0c\u4e5f\u662f\u5b9e\u73b0\u5404\u79cd\u7b97\u6cd5\u548c\u903b\u8f91\u529f\u80fd\u7684\u5173\u952e\u3002\u672c\u6587\u4ecb\u7ecd\u4e86\u7a0b\u5e8f\u7684\u63a7<\/p>\n","protected":false},"author":1,"featured_media":64183,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"default","ast-global-header-display":"","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":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","footnotes":""},"categories":[36],"tags":[305],"class_list":["post-76535","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-blog","tag-dzjs"],"_links":{"self":[{"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/posts\/76535","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/comments?post=76535"}],"version-history":[{"count":0,"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/posts\/76535\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/media\/64183"}],"wp:attachment":[{"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/media?parent=76535"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/categories?post=76535"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.techphant.cn\/wp-json\/wp\/v2\/tags?post=76535"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}