{"id":343,"date":"2023-10-15T08:29:57","date_gmt":"2023-10-15T00:29:57","guid":{"rendered":"https:\/\/wp.minicoda.com\/?p=343"},"modified":"2024-11-02T20:39:46","modified_gmt":"2024-11-02T12:39:46","slug":"%e6%a0%87%e5%87%86%e8%be%93%e5%85%a5%e8%be%93%e5%87%ba","status":"publish","type":"post","link":"https:\/\/wp.minicoda.com\/index.php\/%e6%a0%87%e5%87%86%e8%be%93%e5%85%a5%e8%be%93%e5%87%ba\/","title":{"rendered":"\u6807\u51c6\u8f93\u5165\u8f93\u51fa"},"content":{"rendered":"\n<p>  \u6807\u51c6\u8f93\u51fa\u6982\u5ff5\u6700\u65e9\u8d77\u6e90\u4e8eUnix\u64cd\u4f5c\u7cfb\u7edf\uff0c\u5b83\u9ed8\u8ba4\u6709\u4e09\u4e2a\u57fa\u672c\u9ed8\u8ba4\u7684I\/O\u6d41\uff1a\u6807\u51c6\u8f93\u5165(stdin)\uff0c\u6807\u51c6\u8f93\u51fa(stdout)\u548c\u6807\u51c6\u9519\u8bef(stderr)\u3002<\/p>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u6807\u51c6\u8f93\u5165\u8f93\u51fa\u7684\u6982\u5ff5\u5f62\u6001<\/h2>\n\n\n\n<p>  \u6700\u7b80\u5355\u7684\u6807\u51c6\u8f93\u5165\u8f93\u51fa\u5c31\u662f\u63a7\u5236\u53f0\u6216\u8005Console(\u4e00\u822c\u6307\u4ee3\u8ba1\u7b97\u673a\u5c4f\u5e55)\uff0c\u5927\u90e8\u5206\u73b0\u4ee3\u5316\u64cd\u4f5c\u7cfb\u7edf\u90fd\u63d0\u4f9b\u7684\u662f\u63a7\u5236\u53f0\u6a21\u62df\u5668(\u6bd4\u5982Cmd.exe\u3001macOS\u548cLinux\u53d1\u884c\u7248\u7684\u7ec8\u7aef)\uff0c\u56e0\u4e3a\u73b0\u4ee3\u64cd\u4f5c\u7cfb\u7edf\u652f\u6301\u53ef\u89c6\u5316\u548c\u591a\u4efb\u52a1\u5171\u4eab\u5316\uff0c\u4e0d\u5141\u8bb8\u5e94\u7528\u7a0b\u5e8f\u72ec\u5360\u663e\u793a\u5668\u8f93\u51fa\uff0c\u4e0d\u50cf\u8fdc\u53e4\u65f6\u671f\u5f00\u673a\u5c31\u662f\u9ed1\u8272\u5c4f\u5e55\uff0c\u53ea\u6709\u547d\u4ee4\u884c\u8f93\u5165\u8f93\u51fa\uff0c\u771f\u7684\u662f\"\u63a7\u5236\u53f0\"\u3002<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>DOS\u64cd\u4f5c\u7cfb\u7edf\u3001macOS\/Linux\u7684\u5355\u7528\u6237\u6a21\u5f0f\u90fd\u80fd\u611f\u53d7\u7eaf\u6b63\u7684\"\u63a7\u5236\u53f0\"\u3002<\/li>\n<\/ul>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u4e0d\u540c\u8bed\u8a00\u7684\u8f93\u5165\u8f93\u51fa<\/h2>\n\n\n\n<p>  \u4ece\u6982\u5ff5\u4e0a\uff0c\u8f93\u5165\u8f93\u51fa\u53ef\u4ee5\u7528\u5168\u5c40\u53d8\u91cf\u3001\u5173\u952e\u5b57\u3001\u51fd\u6570\u6216\u8005\u7c7b\u5e93\u5b9e\u73b0\u3002<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>C\u8bed\u8a00\u7528libc\u51fd\u6570scanf\/printf.<\/li>\n\n\n\n<li>ObjC\u662fC\u7684\u8d85\u96c6\uff0c\u9664\u4e86\u53ef\u4f7f\u7528C\u8bed\u8a00\u7684\u8f93\u5165\u8f93\u51fa\uff0c\u8fd8\u5b9a\u4e49\u4e86\u5e26\u65f6\u95f4\u6233\u7684NSLog\u8f93\u51fa\u3002<\/li>\n\n\n\n<li>C++\u652f\u6301C\u8bed\u8a00\u7684scanf\/printf, \u652f\u6301\u7528\u5168\u5c40iostream\u6d41\u5bf9\u8c61cin\u548ccout.<\/li>\n\n\n\n<li>Java\u6807\u51c6\u8f93\u5165\u662f\u9759\u6001\u5bf9\u8c61System.in, \u4f20\u7ed9Scanner\u7c7b\u8c03\u7528next*\u7cfb\u5217\u65b9\u6cd5\uff0c\u9759\u6001\u5bf9\u8c61System.out\u4e3a\u6807\u51c6\u8f93\u51fa\u5bf9\u8c61\uff0c\u63d0\u4f9bprint*\u7cfb\u5217\u65b9\u6cd5\u4f5c\u4e3a\u8f93\u51fa\u3002\u8fd9\u79cd\u5e26\u7c7b\u548c\u65b9\u6cd5\u7684\u5199\u6cd5\uff0c\u6bd4C\/C++\u8981\u7e41\u7410\u3002<\/li>\n\n\n\n<li>C#\u5229\u7528Console\u7c7b\u9759\u6001\u65b9\u6cd5Read*\u548cWrite*\u5b9e\u73b0\u8f93\u5165\u8f93\u51fa\uff0c\u548cJava\u7c7b\u4f3c\uff0c\u4f46\u8f93\u5165\u66f4\u7b80\u6d01\u4e00\u4e9b\u3002<\/li>\n\n\n\n<li>Swift readLine()\u63a5\u6536\u8f93\u5165\u5b57\u7b26\u4e32\uff0cprint\u4f5c\u4e3a\u6807\u51c6\u8f93\u51fa\u3002<\/li>\n\n\n\n<li>Python 2.x print\u662f\u5173\u952e\u5b57\uff0cPython 3 print\u6539\u4e3a\u51fd\u6570\uff0c\u4f7f\u7528\u51fd\u6570\u53ef\u4ee5\u66f4\u7075\u6d3b\u5730\u63a7\u5236\u8f93\u51fa\u3002\u6bd4\u5982\uff0c\u6211\u4eec\u53ef\u4ee5\u6539\u53d8\u8f93\u51fa\u7684\u6837\u5f0f\u3001\u683c\u5f0f\u6216\u8005\u6dfb\u52a0\u66f4\u591a\u7684\u5185\u5bb9\u3002Python\u7684\u8f93\u5165\u662finput.<\/li>\n\n\n\n<li>Ruby\u63d0\u4f9b\u4e86\u4e0d\u540c\u8f93\u51fa\u65b9\u5f0f\uff0cputs\u548cprint\u90fd\u662f\u51fd\u6570\uff0cputs\u6bd4print\u591a\u6362\u884c\u529f\u80fd\uff0cp\u51fd\u6570\u4f1a\u6309\u539f\u6587\u8f93\u51fa\uff0c\u800c\u975e\u5bf9\u8c61\u3002\u6bd4\u5982p \"hello\"\u8f93\u51fa\"hello\"\u800c\u975ehello.<\/li>\n\n\n\n<li>VB\u8bbe\u8ba1\u76ee\u6807\u4e3a\u4e86\u53ef\u89c6\u5316\u7f16\u7a0b\uff0c\u8f93\u5165\u8f93\u51fa\u8bbe\u8ba1\u7684\u4e0e\u4f17\u4e0d\u540c\uff0c\u7a97\u4f53\u7528Print\u663e\u793a\u5b57\u7b26\u4e32\uff0cInputBox\u548cMsgBox\u5c55\u793a\u8f93\u5165\u8f93\u51fa\uff0c\u5f53\u7136\u4e5f\u53ef\u4ee5\u8c03\u7528Windows kernel*.dll\u7684ReadConsole\/WriteConsole\u51fd\u6570\uff0c\u5230.NET\u7248\u672c\u53ef\u4f7f\u7528\u7c7b\u4f3cC#\u98ce\u683cConsole.Read*\/Write*.<\/li>\n\n\n\n<li>JS\u53ef\u4f7f\u7528prompt\u548calert\u5728\u5ba2\u6237\u7aef\u6d4f\u89c8\u5668\u5f39\u51fa\u8f93\u5165\u548c\u63d0\u793a\u6846\uff0cconsole.log\u63d0\u4f9b\u65e5\u5fd7\u8f93\u51fa\u3002console\u6700\u65e9\u662fIE\u7684JScript\u5f15\u64ce\u624d\u6709\u7684\u8c03\u8bd5\u5de5\u5177\uff0c\u540e\u6765\u9010\u6e10\u53d8\u6210\u6807\u51c6\u3002Node.js\u4e2d\uff0c\u53ef\u5229\u7528readline\u5b9e\u73b0\u547d\u4ee4\u884c\u6807\u51c6\u8f93\u5165\u3002<\/li>\n\n\n\n<li>Rust\u8f93\u5165\u662fio::stdin().read_line, \u8f93\u51fa\u662fprintln!.<\/li>\n\n\n\n<li>Go\u8bed\u8a00fmt.Scan\u662f\u8f93\u5165\uff0cfmt.Print*\u7cfb\u5217\u4e3a\u8f93\u51fa\uff0c\u548cC\u8bed\u8a00\u5f62\u4f3c\u3002<\/li>\n\n\n\n<li>\u4ed3\u9889\u7528print\/println\u4f5c\u4e3a\u8f93\u51fa\uff0c\u4e5f\u53ef\u4ee5\u7528std.console\u5305\u7684Console*\u7c7b\u505a\u5e76\u53d1\u5b89\u5168\u7684\u8f93\u5165\u8f93\u51fa\u3002<\/li>\n\n\n\n<li>Fortran\u7684\u8f93\u5165\u8f93\u51fa\u7a0d\u663e\u602a\u5f02\uff1a<br>print *, \"hello world\"<br>read (*, *) age<\/li>\n\n\n\n<li>Pascal\u8f93\u5165\u8f93\u51fa\u5982\u4e0b\uff1a<br>Read\u548cReadln, Write\u548cWriteln.<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>\u6807\u51c6\u8f93\u51fa\u6982\u5ff5\u6700\u65e9\u8d77\u6e90\u4e8eUnix\u64cd\u4f5c\u7cfb\u7edf\uff0c\u5b83\u9ed8\u8ba4\u6709\u4e09\u4e2a\u57fa\u672c\u9ed8\u8ba4\u7684I\/O\u6d41\uff1a\u6807\u51c6\u8f93\u5165(stdin)\uff0c\u6807\u51c6\u8f93\u51fa(stdout)\u548c\u6807\u51c6\u9519\u8bef(stderr)\u3002 \u6807\u51c6\u8f93\u5165\u8f93\u51fa\u7684\u6982\u5ff5\u5f62\u6001 \u6700\u7b80\u5355\u7684\u6807\u51c6\u8f93\u5165\u8f93\u51fa\u5c31\u662f\u63a7&#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8,128],"tags":[9,129],"class_list":["post-343","post","type-post","status-publish","format-standard","hentry","category-8","category-128","tag-9","tag-129"],"views":216,"_links":{"self":[{"href":"https:\/\/wp.minicoda.com\/index.php\/wp-json\/wp\/v2\/posts\/343","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wp.minicoda.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wp.minicoda.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wp.minicoda.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/wp.minicoda.com\/index.php\/wp-json\/wp\/v2\/comments?post=343"}],"version-history":[{"count":9,"href":"https:\/\/wp.minicoda.com\/index.php\/wp-json\/wp\/v2\/posts\/343\/revisions"}],"predecessor-version":[{"id":3245,"href":"https:\/\/wp.minicoda.com\/index.php\/wp-json\/wp\/v2\/posts\/343\/revisions\/3245"}],"wp:attachment":[{"href":"https:\/\/wp.minicoda.com\/index.php\/wp-json\/wp\/v2\/media?parent=343"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wp.minicoda.com\/index.php\/wp-json\/wp\/v2\/categories?post=343"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wp.minicoda.com\/index.php\/wp-json\/wp\/v2\/tags?post=343"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}