{"id":154,"date":"2024-01-08T09:58:14","date_gmt":"2024-01-08T01:58:14","guid":{"rendered":"https:\/\/www.zengtongxue.com\/?p=154"},"modified":"2024-01-08T17:16:57","modified_gmt":"2024-01-08T09:16:57","slug":"%e5%9b%9b%e3%80%81%e5%8f%98%e9%87%8f%ef%bc%88%e7%ac%ac7%e8%af%be%ef%bc%89","status":"publish","type":"post","link":"https:\/\/www.zengtongxue.com\/index.php\/2024\/01\/08\/%e5%9b%9b%e3%80%81%e5%8f%98%e9%87%8f%ef%bc%88%e7%ac%ac7%e8%af%be%ef%bc%89\/","title":{"rendered":"\u56db\u3001\u53d8\u91cf\uff08\u7b2c7\u8bfe-\u7b2c9\u8bfe\uff09"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">\u7b2c\u4e00\u90e8\u5206\u53d8\u91cf\u7684\u7c7b\u578b<\/h2>\n\n\n\n<p>\u8bfe\u7a0b\u94fe\u63a5\uff1a<\/p>\n\n\n\n<p><a href=\"https:\/\/www.bilibili.com\/video\/BV1NA4y1R7vL\/?p=7&amp;spm_id_from=333.1007.top_right_bar_window_history.content.click&amp;vd_source=0f636f173a0a5855cca528319972bfe9\">7\u3001\u53d8\u91cf\uff08\u4e2d\uff09_\u54d4\u54e9\u54d4\u54e9_bilibili<\/a><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u8bfe\u7a0b\u7b14\u8bb0<\/h3>\n\n\n\n<p>\u4f7f\u7528var\u5728\u58f0\u660e\u53d8\u91cf\u7684\u8fc7\u7a0b\u4e2d\uff0c\u4f1a\u81ea\u52a8\u63a8\u5bfc\u53d8\u91cf\u7684\u7c7b\u578b\u3002<\/p>\n\n\n\n<p class=\"has-cyan-bluish-gray-color has-text-color has-link-color has-small-font-size wp-elements-2d32375cb9c2d9909c76a142443c9603\">\u5728\u672c\u6559\u7a0b\u4e2d\uff0c\u4ec5\u5b66\u4e60\u4e86\u4e09\u79cd\u53d8\u91cf\u7c7b\u578b\u3002\u6211\u5728\u5b66\u4e60unity\u6e38\u620f\u5f00\u53d1\u8fc7\u7a0b\u4e2d\uff0c\u53d1\u73b0\u7ecf\u5e38\u4f1a\u4f7f\u7528\u5230\u6d6e\u70b9\u6570\u7c7b\u578b\u7684\u53d8\u91cf\uff0c\u6240\u4ee5\u5728\u8fd9\u91cc\u8865\u5145\u4e86\u6d6e\u70b9\u6570\u7684\u76f8\u5173\u5185\u5bb9\u3002\u672a\u6765\u4e5f\u4f1a\u6839\u636e\u81ea\u5df1\u7684\u5b9e\u9645\u9700\u8981\u770b\u662f\u5426\u9700\u8981\u8865\u5145\u6216\u8003\u8651\u5b66\u4e60\u66f4\u591a\u53d8\u91cf\u7c7b\u578b\u7684\u5185\u5bb9\u3002<\/p>\n\n\n\n<p>\u611f\u5174\u8da3\u53ef\u4ee5\u67e5\u770b\ud83d\udc49<a href=\"https:\/\/www.runoob.com\/csharp\/csharp-data-types.html\">\u6570\u636e\u7c7b\u578b<\/a><\/p>\n\n\n\n<h4 class=\"wp-block-heading\">string \u5b57\u7b26\u4e32<\/h4>\n\n\n\n<p>\u5b57\u7b26\u4e32\u5185\u5bb9\u9700\u8981\u5199\u5728\u82f1\u6587\u7684\u5f15\u53f7\u5185\u3002<\/p>\n\n\n\n<p class=\"has-cyan-bluish-gray-color has-text-color has-link-color wp-elements-614c646ef8fd2e548d1e0dd27b41a45d\">\u6211\u81ea\u5df1\u5bf9\u5b57\u7b26\u4e32\u7684\u7406\u89e3\u5c31\u662f\u8fd9\u4e2a\u6570\u636e\u662f\u4e00\u5806\u6587\u5b57\u7b26\u53f7\u3002\u4ee3\u7801\u4e2d\u8f93\u5165\u7684\u662f\u4ec0\u4e48\uff0c\u6700\u540e\u663e\u793a\u51fa\u6765\u5c31\u662f\u4ec0\u4e48\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"csharp\" class=\"language-csharp\">string name = \"\u66fe\u540c\u5b66\";\/\/\u5728\u5185\u5b58\u4e2d\u5b58\u50a8\u7684\u6570\u636e\u4ecd\u7136\u662f\u4e8c\u8fdb\u5236\u7684\u3002<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">int \u6574\u6570\uff0832 \u4f4d\u6709\u7b26\u53f7\u6574\u6570\u7c7b\u578b\uff09<\/h4>\n\n\n\n<p>100\u3001200\u30015\u90fd\u662f\u6574\u6570\u3002\u4e0d\u5305\u62ec\u5c0f\u6570\u70b9\u7684\u6570\u3002\u5305\u62ec\u8d1f\u6570<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"csharp\" class=\"language-csharp\">int a = 100;<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"bool-data\">bool \u5e03\u5c14<\/h4>\n\n\n\n<p>\u5e03\u5c14\u7c7b\u578b\u7684\u53d8\u91cf\u6709\u4e24\u4e2a\u503c\uff1atrue\u548cfalse\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"csharp\" class=\"language-csharp\">bool bool1 = true;\n\nbool bool1 = 1 &lt; 0;\/\/ \u5e03\u5c14\u7c7b\u578b\u7684\u53d8\u91cf\u5728\u8d4b\u503c\u53f7\uff08=\uff09\u7684\u53f3\u8fb9\u53ef\u4ee5\u662f\u4e00\u4e2a\u8868\u8fbe\u5f0f\uff0c\u8fd9\u4e2a\u8868\u8fbe\u5f0f\u7684\u5224\u5b9a\u7ed3\u679c\u4e3atrue\uff0c\u5219\u5e03\u5c14\u53d8\u91cf\u7684\u503c\u4e3atrue\u3002\u6bd4\u5982\u8fd9\u91cc\u76841&lt;0\u662f\u4e0d\u5bf9\u7684\uff0c\u5373\u7ed3\u679c\u4e3afalse\uff0c\u6240\u4ee5\u8fd9\u4e00\u884c\u4ee3\u7801\u5b9e\u9645\u8fd4\u56de\u7684\u503c\u662fbool1 = flase\u3002<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">float \u6d6e\u70b9\u6570\uff0832 \u4f4d\u5355\u7cbe\u5ea6\u6d6e\u70b9\u578b\uff09<\/h4>\n\n\n\n<p>\u5e26\u5c0f\u6570\u70b9\u7684\u6570\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"csharp\" class=\"language-csharp\">float a = 1.2;<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">\u7b2c\u4e8c\u90e8\u5206 \u53d8\u91cf\u8d4b\u503c<\/h2>\n\n\n\n<p>\u8bfe\u7a0b\u94fe\u63a5\uff1a<\/p>\n\n\n\n<p><a href=\"https:\/\/www.bilibili.com\/video\/BV1NA4y1R7vL?p=8&amp;vd_source=0f636f173a0a5855cca528319972bfe9\">8\u3001\u53d8\u91cf\uff08\u4e0b\uff09_\u54d4\u54e9\u54d4\u54e9_bilibili<\/a><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u5b66\u4e60\u7b14\u8bb0<\/h3>\n\n\n\n<p>\u7a0b\u5e8f\u662f\u4e00\u884c\u4e00\u884c\u5730\u8fdb\u884c\u6267\u884c\u7684\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"csharp\" class=\"language-csharp\">int n1=20;\nint n2=30;\nn1=n2\/\/\u6b64\u65f6n1=30\nn2=n1\/\/\u6b64\u65f6n2=30<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"csharp\" class=\"language-csharp\">\/\/\u5b9e\u73b0n1 \u548cn2 \u7684\u503c\u5bf9\u6362\n\nint n1=20;\nint n2=30;\nint temp = 0\n\ntemp=n2\/\/temp\u73b0\u5728=30\nn2=n1\/\/n2=20\nn1=temp\/\/n1=30<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">\u7b2c\u4e09\u90e8\u5206 \u53d8\u91cf\u7684\u8fd0\u7b97<\/h2>\n\n\n\n<p>\u8bfe\u7a0b\u94fe\u63a5\uff1a<\/p>\n\n\n\n<p><a href=\"https:\/\/www.bilibili.com\/video\/BV1NA4y1R7vL?p=9&amp;vd_source=0f636f173a0a5855cca528319972bfe9\">9.\u4e0d\u540c\u53d8\u91cf\u4e4b\u95f4\u7684\u8fd0\u7b97<\/a><\/p>\n\n\n\n<p>\u8ba9\u7528\u6237\u81ea\u5df1\u8f93\u5165\u6570\u636e\u8fdb\u884c\u8fd0\u7b97<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"csharp\" class=\"language-csharp\">Console.ReadLine()\/\/\u7528\u4e8e\u76d1\u6d4b\u7528\u6237\u8f93\u5165\u7684\u4e00\u884c\u5185\u5bb9\u7684\u65b9\u6cd5\u3002<\/code><\/pre>\n\n\n\n<p>\u5c06\u7528\u6237\u8f93\u5165\u7684\u503c\u8fdb\u884c\u5b58\u50a8<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"csharp\" class=\"language-csharp\">string name = Console.ReadLine()\/\/\u7528\u4e00\u4e2a\u5b57\u7b26\u4e32\u7c7b\u578b\u7684\u53d8\u91cfname\u6765\u5b58\u50a8\u7528\u6237\u8f93\u5165\u7684\u5185\u5bb9\u3002\u6216\u8005\u8bf4\u5c06\u7528\u6237\u8f93\u5165\u7684\u5185\u5bb9\u8d4b\u4e88\u7ed9\u5b57\u7b26\u4e32\u7c7b\u578b\u7684\u53d8\u91cfname\u3002<\/code><\/pre>\n\n\n\n<p>\u5728\u8fdb\u884c\u6570\u636e\u8fd0\u7b97\u524d\uff0c\u9700\u8981\u5148\u68c0\u67e5\u6570\u636e\u662f\u5426\u9700\u8981\u8fdb\u884c<strong><a href=\"#data-conversion\">\u6570\u636e\u7c7b\u578b\u8f6c\u6362<\/a><\/strong>\u3002\u53ef\u4ee5\u67e5\u770b\u4e0b\u9762\u8fd9\u4e2a\u6536\u96c6\u8868\u7684\u6848\u4f8b\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u5c1d\u8bd5\u5199\u4e00\u4e2a\u7b80\u5355\u7684\u6536\u96c6\u8868<\/h3>\n\n\n\n<p>\u5c1d\u8bd5\u6839\u636e\u6559\u7a0b\u5185\u5bb9\u7f16\u5199\u4e00\u4e2a\u8ba1\u7b97\u4f60\u8ddf\u4f60\u914d\u5076\u5e74\u9f84\u7684\u5e94\u7528\u9047\u5230\u95ee\u9898\uff1a<\/p>\n\n\n\n<pre title=\"\u51fa\u73b0\u9519\u8bef\" class=\"wp-block-code\"><code lang=\"csharp\" class=\"language-csharp\">using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace HelloWordCS\n{\n    internal class Program\n    {\n        static void Main()\n        {\n            Console.WriteLine(\"\u8f93\u5165\u7528\u6237\u540d\uff1a\");\n            string name = Console.ReadLine();\n            Console.WriteLine(name);\n            Console.WriteLine(\"\u8f93\u5165\u4f60\u7684\u5e74\u9f84:\");\n            int age1 = Console.ReadLine();\n            Console.WriteLine(age1);\n            Console.WriteLine(\"\u8f93\u5165\u4f60\u914d\u5076\u7684\u5e74\u9f84:\");\n            int age2 = Console.ReadLine();\n            Console.WriteLine(age2);\n            int ageSum = age1 + age2;\n            Console.WriteLine(\"\u4f60\u548c\u4f60\u914d\u5076\u5e74\u9f84\u7684\u548c\u662f\"+ageSum);\n\n            Console.ReadKey();\n        }\n    }\n}\/\/\u9519\u8bef\u63d0\u793a\uff1a\u65e0\u6cd5\u5c06\u201cstring\u201d\u9690\u5f0f\u8f6c\u6362\u4e3a\u201cint\u201d<\/code><\/pre>\n\n\n\n<p>\u6211\u81ea\u5df1\u731c\u6d4b\u4e4b\u6240\u4ee5\u4f1a\u51fa\u73b0\u8fd9\u4e2a\u95ee\u9898\u53ef\u80fd\u662f\u56e0\u4e3aReadline\uff08\uff09\u65b9\u6cd5\u9ed8\u8ba4\u63a5\u6536\u7528\u6237\u8f93\u5165\u7684\u5185\u5bb9\u4e3a\u5b57\u7b26\u4e32\uff08string\uff09\u3002\u867d\u7136\u6211\u4eec\u5728\u58f0\u660e\u53d8\u91cf\u7684\u65f6\u5019\u5c06\u5176\u7533\u660e\u4e3a\u4e86int\u3002\u5373\u201cint age1 = Console.ReadLine();\u201d\u8d4b\u503c\u53f7\u7684\u5de6\u8fb9 age1 \u662f\u4e00\u4e2a\u6574\u6570\uff0c\u4f46\u662f\u53f3\u8fb9\u63a5\u6536\u7684\u662f\u5b57\u7b26\u4e32\uff0c\u65e0\u6cd5\u88ab\u8d4b\u4e88\u3002<\/p>\n\n\n\n<p>\u5c1d\u8bd5\u8c03\u6574\u4ee3\u7801<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"csharp\" class=\"language-csharp\">using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace HelloWordCS\n{\n    internal class Program\n    {\n        static void Main()\n        {\n            Console.WriteLine(\"\u8f93\u5165\u7528\u6237\u540d\uff1a\");\n            string name = Console.ReadLine();\n            Console.WriteLine(name);\n            Console.WriteLine(\"\u8f93\u5165\u4f60\u7684\u5e74\u9f84:\");\n            string age1 = Console.ReadLine();\/\/\u5148\u63a5\u53d7\u4e00\u4e2a\u5b57\u7b26\u4e32\n            int a = int.Parse(age1);\/\/\u5c06age1\u8f6c\u5316\u6210\u6574\u6570\u5e76\u5b58\u5728\u53d8\u91cfa\u4e2d\n            Console.WriteLine(age1);\n            Console.WriteLine(\"\u8f93\u5165\u4f60\u914d\u5076\u7684\u5e74\u9f84:\");\n            string age2 = Console.ReadLine();\n            int b = int.Parse(age2);\/\/\u5c06age1\u8f6c\u5316\u6210\u6574\u6570\u5e76\u5b58\u5728\u53d8\u91cfa\u4e2d\n            Console.WriteLine(age2);\n            int ageSum = a + b;\n            Console.WriteLine(\"\u4f60\u548c\u4f60\u914d\u5076\u5e74\u9f84\u7684\u548c\u662f\"+ageSum);\n\n            Console.ReadKey();\n        }\n    }\n}<\/code><\/pre>\n\n\n\n<p>\u5c1d\u8bd5\u8fd0\u884c\uff0c\u89e3\u51b3\u95ee\u9898\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"576\" src=\"https:\/\/www.zengtongxue.com\/wp-content\/uploads\/2024\/01\/image-8-1024x576.png\" alt=\"\" class=\"wp-image-184\" srcset=\"https:\/\/www.zengtongxue.com\/wp-content\/uploads\/2024\/01\/image-8-1024x576.png 1024w, https:\/\/www.zengtongxue.com\/wp-content\/uploads\/2024\/01\/image-8-300x169.png 300w, https:\/\/www.zengtongxue.com\/wp-content\/uploads\/2024\/01\/image-8-768x432.png 768w, https:\/\/www.zengtongxue.com\/wp-content\/uploads\/2024\/01\/image-8.png 1129w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>\u8fd9\u90e8\u5206\u6d89\u53ca\u5230\u4e0d\u540c\u7c7b\u578b\u7684\u7684\u6570\u636e\u7c7b\u578b\u7684\u8f6c\u6362\u3002<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"data-conversion\">\u4e0d\u540c\u7c7b\u578b\u6570\u636e\u7684\u8f6c\u6362<\/h4>\n\n\n\n<pre title=\"int.Paser\uff08\uff09\" class=\"wp-block-code\"><code lang=\"csharp\" class=\"language-csharp\">string age1 = Console.ReadLine();\/\/\u5148\u63a5\u53d7\u4e00\u4e2a\u5b57\u7b26\u4e32\nint a = int.Parse(age1);\/\/int.Parse() \u5c06\u6570\u636e\u8f6c\u6362\u6210int\u7c7b\u578b\u7684\u503c\u3002<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">\/\/\u5c06\u6574\u6570\u8f6c\u6362\u6210\u5b57\u7b26\u4e32\n20.ToString();<\/code><\/pre>\n\n\n\n<p class=\"has-vivid-red-color has-text-color has-link-color wp-elements-732435b8f458eb56b6e1346df3256863\"><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-contrast-color\">\u901a\u5e38\u90fd\u9700\u8981<\/mark><strong><mark style=\"background-color:rgba(0, 0, 0, 0);color:#e982dc\" class=\"has-inline-color\">\u5148\u5bf9\u6570\u636e\u7c7b\u578b\u8f6c\u6362\u4e3a\u540c\u4e00\u7c7b\u578b\u7684\u6570\u636e\u518d\u8fdb\u884c\u8fd0\u7b97<\/mark><\/strong>\uff0c<mark style=\"background-color:rgba(0, 0, 0, 0);color:#e982dc\" class=\"has-inline-color\"><strong>\u4e14\u6700\u540e\u5b58\u50a8\u7684\u6570\u636e\u7c7b\u578b\u4e5f\u5e94\u8be5\u4fdd\u6301\u4e00\u81f4\u3002<\/strong><\/mark><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u7b2c\u4e00\u90e8\u5206\u53d8\u91cf\u7684\u7c7b\u578b \u8bfe\u7a0b\u94fe\u63a5\uff1a 7\u3001\u53d8\u91cf\uff08\u4e2d\uff09_\u54d4\u54e9\u54d4\u54e9_bilibili \u8bfe\u7a0b\u7b14\u8bb0 \u4f7f\u7528var\u5728\u58f0\u660e\u53d8\u91cf\u7684\u8fc7 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":158,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12,7,3],"tags":[],"class_list":["post-154","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-c","category-unity","category-3"],"_links":{"self":[{"href":"https:\/\/www.zengtongxue.com\/index.php\/wp-json\/wp\/v2\/posts\/154","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.zengtongxue.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.zengtongxue.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.zengtongxue.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.zengtongxue.com\/index.php\/wp-json\/wp\/v2\/comments?post=154"}],"version-history":[{"count":25,"href":"https:\/\/www.zengtongxue.com\/index.php\/wp-json\/wp\/v2\/posts\/154\/revisions"}],"predecessor-version":[{"id":205,"href":"https:\/\/www.zengtongxue.com\/index.php\/wp-json\/wp\/v2\/posts\/154\/revisions\/205"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.zengtongxue.com\/index.php\/wp-json\/wp\/v2\/media\/158"}],"wp:attachment":[{"href":"https:\/\/www.zengtongxue.com\/index.php\/wp-json\/wp\/v2\/media?parent=154"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.zengtongxue.com\/index.php\/wp-json\/wp\/v2\/categories?post=154"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.zengtongxue.com\/index.php\/wp-json\/wp\/v2\/tags?post=154"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}