From a06b1c33f7b8f0767fe922e3771abacef4a323a6 Mon Sep 17 00:00:00 2001 From: Dong <1416943999@qq.com> Date: Wed, 26 Feb 2025 16:41:25 +0800 Subject: [PATCH 01/37] 123 --- .../ed9d3fd8-cc5d-4a9e-8059-1b0c8cd2c7ed.vsidx | Bin 0 -> 3550 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 .vs/ConsoleApp1/FileContentIndex/ed9d3fd8-cc5d-4a9e-8059-1b0c8cd2c7ed.vsidx diff --git a/.vs/ConsoleApp1/FileContentIndex/ed9d3fd8-cc5d-4a9e-8059-1b0c8cd2c7ed.vsidx b/.vs/ConsoleApp1/FileContentIndex/ed9d3fd8-cc5d-4a9e-8059-1b0c8cd2c7ed.vsidx new file mode 100644 index 0000000000000000000000000000000000000000..28e0445e4a5dd80147f0043e3d206eb4c315e9cf GIT binary patch literal 3550 zcmbW3=W<(B6orrM5E3v1C-kbA7DFsKRO2YZvYKU8q$^~D0EfiHq*%ss=nx2ogwT73 z(0lIz2FMKWzzoA1@DQxE&$1yu_`{X%`cBzrpS|}zSEFPq+r7-W14lW#_ItPzm>g`@ z+mo~H=G4w+YO=j;t~Jx#+?oqdPtG-yt?71a`($EfX5D|aBb(YYv#qV!zK-9*d;bXi zA8(b})|T0gJK#xSxxWtn{wKW^JN!r|5ON(Mw=(38K?6PC2(b}z9E9>~HhwT{gG0_C z^WCuVUmFZN_wVt=?qOyFKNGgfyPa6rf*x#N?;keUVwLTS*zo1-p<%3aZpyh4=Q=Gg z*m&pjX67AY1dU~WmxXZ{z&RZHC5RB4!VH5b0+yh`WYK_gzo~_XsUe%|LuL#QDc_hd`)*t4$B`YD(9%*^W%OMKC=1-A16AX7BZWiSiI$QQdaHfYyUXBWD5!8fzB z8z;-?51eyL)W^B7aW19p;Uayozg#>*JW}iu`QFj)XmN#zq-?xfM3mM?*2ZJS#Eh?j|j;(9SAZV=<*<>HW-5QoL2m=e=sM$C#MVon?t^I}0Piu}Rl zIVg)2@d~jj*2F-pi&u&baZDT+uM)2oo8mR%wc>T+gt$?>Ufd*Z7AM6U#4X~Kc%!&g z+$L@pcZkzsOPmpJ5@*FW$ait4`ZtTWh_{NjiMNY)h;#Cybh#ogk4;=Fjj z_<*=a+$%mP?h_vp9~K`G9~B=H9~YkxpA?@GpBA4HpB0}IpBG;cUld;wUlv~xUlm^y z_lvKKZ-{S-Z;5Ybpu%4?*`F| zT0du6GA)}{Oamx=#>`vHyu}>7#SmM_p*-D;smC-AP1^|T z$tY8%8PfvR^G&7JpnTi-w)j)VS)RTCmEj0$#LQ^vV<&lT#&Oqed>nbO&v`yKRwQn7 sIp{y@cwUosUaR)&kh4=8!%Ch|uIK*^fANQDh1&e} Date: Thu, 27 Feb 2025 10:18:49 +0800 Subject: [PATCH 02/37] =?UTF-8?q?=E7=AC=AC=E4=B8=80=E6=AC=A1=E6=8F=90?= =?UTF-8?q?=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ed9d3fd8-cc5d-4a9e-8059-1b0c8cd2c7ed.vsidx | Bin 3550 -> 0 bytes Xzt/Program.cs | 2 ++ 2 files changed, 2 insertions(+) delete mode 100644 .vs/ConsoleApp1/FileContentIndex/ed9d3fd8-cc5d-4a9e-8059-1b0c8cd2c7ed.vsidx create mode 100644 Xzt/Program.cs diff --git a/.vs/ConsoleApp1/FileContentIndex/ed9d3fd8-cc5d-4a9e-8059-1b0c8cd2c7ed.vsidx b/.vs/ConsoleApp1/FileContentIndex/ed9d3fd8-cc5d-4a9e-8059-1b0c8cd2c7ed.vsidx deleted file mode 100644 index 28e0445e4a5dd80147f0043e3d206eb4c315e9cf..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3550 zcmbW3=W<(B6orrM5E3v1C-kbA7DFsKRO2YZvYKU8q$^~D0EfiHq*%ss=nx2ogwT73 z(0lIz2FMKWzzoA1@DQxE&$1yu_`{X%`cBzrpS|}zSEFPq+r7-W14lW#_ItPzm>g`@ z+mo~H=G4w+YO=j;t~Jx#+?oqdPtG-yt?71a`($EfX5D|aBb(YYv#qV!zK-9*d;bXi zA8(b})|T0gJK#xSxxWtn{wKW^JN!r|5ON(Mw=(38K?6PC2(b}z9E9>~HhwT{gG0_C z^WCuVUmFZN_wVt=?qOyFKNGgfyPa6rf*x#N?;keUVwLTS*zo1-p<%3aZpyh4=Q=Gg z*m&pjX67AY1dU~WmxXZ{z&RZHC5RB4!VH5b0+yh`WYK_gzo~_XsUe%|LuL#QDc_hd`)*t4$B`YD(9%*^W%OMKC=1-A16AX7BZWiSiI$QQdaHfYyUXBWD5!8fzB z8z;-?51eyL)W^B7aW19p;Uayozg#>*JW}iu`QFj)XmN#zq-?xfM3mM?*2ZJS#Eh?j|j;(9SAZV=<*<>HW-5QoL2m=e=sM$C#MVon?t^I}0Piu}Rl zIVg)2@d~jj*2F-pi&u&baZDT+uM)2oo8mR%wc>T+gt$?>Ufd*Z7AM6U#4X~Kc%!&g z+$L@pcZkzsOPmpJ5@*FW$ait4`ZtTWh_{NjiMNY)h;#Cybh#ogk4;=Fjj z_<*=a+$%mP?h_vp9~K`G9~B=H9~YkxpA?@GpBA4HpB0}IpBG;cUld;wUlv~xUlm^y z_lvKKZ-{S-Z;5Ybpu%4?*`F| zT0du6GA)}{Oamx=#>`vHyu}>7#SmM_p*-D;smC-AP1^|T z$tY8%8PfvR^G&7JpnTi-w)j)VS)RTCmEj0$#LQ^vV<&lT#&Oqed>nbO&v`yKRwQn7 sIp{y@cwUosUaR)&kh4=8!%Ch|uIK*^fANQDh1&e} Date: Thu, 27 Feb 2025 02:23:52 +0000 Subject: [PATCH 03/37] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=96=87=E4=BB=B6=20Xz?= =?UTF-8?q?t?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Xzt/Program.cs | 2 -- 1 file changed, 2 deletions(-) delete mode 100644 Xzt/Program.cs diff --git a/Xzt/Program.cs b/Xzt/Program.cs deleted file mode 100644 index 3751555c..00000000 --- a/Xzt/Program.cs +++ /dev/null @@ -1,2 +0,0 @@ -// See https://aka.ms/new-console-template for more information -Console.WriteLine("Hello, World!"); -- Gitee From 8bd461df03e297dce63fc89db47042eebad138df Mon Sep 17 00:00:00 2001 From: Xzt <2399703480@qq.com> Date: Thu, 27 Feb 2025 10:18:49 +0800 Subject: [PATCH 04/37] =?UTF-8?q?=E7=AC=AC=E4=B8=80=E6=AC=A1=E6=8F=90?= =?UTF-8?q?=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ed9d3fd8-cc5d-4a9e-8059-1b0c8cd2c7ed.vsidx | Bin 3550 -> 0 bytes Xzt/Program.cs | 2 ++ 2 files changed, 2 insertions(+) delete mode 100644 .vs/ConsoleApp1/FileContentIndex/ed9d3fd8-cc5d-4a9e-8059-1b0c8cd2c7ed.vsidx create mode 100644 Xzt/Program.cs diff --git a/.vs/ConsoleApp1/FileContentIndex/ed9d3fd8-cc5d-4a9e-8059-1b0c8cd2c7ed.vsidx b/.vs/ConsoleApp1/FileContentIndex/ed9d3fd8-cc5d-4a9e-8059-1b0c8cd2c7ed.vsidx deleted file mode 100644 index 28e0445e4a5dd80147f0043e3d206eb4c315e9cf..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3550 zcmbW3=W<(B6orrM5E3v1C-kbA7DFsKRO2YZvYKU8q$^~D0EfiHq*%ss=nx2ogwT73 z(0lIz2FMKWzzoA1@DQxE&$1yu_`{X%`cBzrpS|}zSEFPq+r7-W14lW#_ItPzm>g`@ z+mo~H=G4w+YO=j;t~Jx#+?oqdPtG-yt?71a`($EfX5D|aBb(YYv#qV!zK-9*d;bXi zA8(b})|T0gJK#xSxxWtn{wKW^JN!r|5ON(Mw=(38K?6PC2(b}z9E9>~HhwT{gG0_C z^WCuVUmFZN_wVt=?qOyFKNGgfyPa6rf*x#N?;keUVwLTS*zo1-p<%3aZpyh4=Q=Gg z*m&pjX67AY1dU~WmxXZ{z&RZHC5RB4!VH5b0+yh`WYK_gzo~_XsUe%|LuL#QDc_hd`)*t4$B`YD(9%*^W%OMKC=1-A16AX7BZWiSiI$QQdaHfYyUXBWD5!8fzB z8z;-?51eyL)W^B7aW19p;Uayozg#>*JW}iu`QFj)XmN#zq-?xfM3mM?*2ZJS#Eh?j|j;(9SAZV=<*<>HW-5QoL2m=e=sM$C#MVon?t^I}0Piu}Rl zIVg)2@d~jj*2F-pi&u&baZDT+uM)2oo8mR%wc>T+gt$?>Ufd*Z7AM6U#4X~Kc%!&g z+$L@pcZkzsOPmpJ5@*FW$ait4`ZtTWh_{NjiMNY)h;#Cybh#ogk4;=Fjj z_<*=a+$%mP?h_vp9~K`G9~B=H9~YkxpA?@GpBA4HpB0}IpBG;cUld;wUlv~xUlm^y z_lvKKZ-{S-Z;5Ybpu%4?*`F| zT0du6GA)}{Oamx=#>`vHyu}>7#SmM_p*-D;smC-AP1^|T z$tY8%8PfvR^G&7JpnTi-w)j)VS)RTCmEj0$#LQ^vV<&lT#&Oqed>nbO&v`yKRwQn7 sIp{y@cwUosUaR)&kh4=8!%Ch|uIK*^fANQDh1&e} Date: Thu, 27 Feb 2025 10:27:58 +0800 Subject: [PATCH 05/37] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=96=87=E4=BB=B6=20Xz?= =?UTF-8?q?t?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- {Xzt => dong/ConsoleApp1/ConsoleApp1}/Program.cs | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {Xzt => dong/ConsoleApp1/ConsoleApp1}/Program.cs (100%) diff --git a/Xzt/Program.cs b/dong/ConsoleApp1/ConsoleApp1/Program.cs similarity index 100% rename from Xzt/Program.cs rename to dong/ConsoleApp1/ConsoleApp1/Program.cs -- Gitee From 9fa51979b90d46e0a5759578741346bb2aa9fe4e Mon Sep 17 00:00:00 2001 From: Dong <15469868+dong432@user.noreply.gitee.com> Date: Thu, 27 Feb 2025 02:31:25 +0000 Subject: [PATCH 06/37] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=96=87=E4=BB=B6=20do?= =?UTF-8?q?ng/ConsoleApp1/ConsoleApp1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dong/ConsoleApp1/ConsoleApp1/Program.cs | 2 -- 1 file changed, 2 deletions(-) delete mode 100644 dong/ConsoleApp1/ConsoleApp1/Program.cs diff --git a/dong/ConsoleApp1/ConsoleApp1/Program.cs b/dong/ConsoleApp1/ConsoleApp1/Program.cs deleted file mode 100644 index 3751555c..00000000 --- a/dong/ConsoleApp1/ConsoleApp1/Program.cs +++ /dev/null @@ -1,2 +0,0 @@ -// See https://aka.ms/new-console-template for more information -Console.WriteLine("Hello, World!"); -- Gitee From d787707cf84c2cceaed1b83f36d3fa3021b522c4 Mon Sep 17 00:00:00 2001 From: Dong <15469868+dong432@user.noreply.gitee.com> Date: Thu, 27 Feb 2025 02:37:49 +0000 Subject: [PATCH 07/37] =?UTF-8?q?rename=20dong/=E6=96=B0=E5=BB=BA=20?= =?UTF-8?q?=E6=96=87=E6=9C=AC=E6=96=87=E6=A1=A3.txt=20to=20dong/123.txt.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Dong <15469868+dong432@user.noreply.gitee.com> --- dong/123.txt | 10 ++++++++++ ...46\226\207\346\234\254\346\226\207\346\241\243.txt" | 0 2 files changed, 10 insertions(+) create mode 100644 dong/123.txt delete mode 100644 "dong/\346\226\260\345\273\272 \346\226\207\346\234\254\346\226\207\346\241\243.txt" diff --git a/dong/123.txt b/dong/123.txt new file mode 100644 index 00000000..a6ca7a24 --- /dev/null +++ b/dong/123.txt @@ -0,0 +1,10 @@ +#include + +using namespace std; + +int main() +{ + + + return 0; +} \ No newline at end of file diff --git "a/dong/\346\226\260\345\273\272 \346\226\207\346\234\254\346\226\207\346\241\243.txt" "b/dong/\346\226\260\345\273\272 \346\226\207\346\234\254\346\226\207\346\241\243.txt" deleted file mode 100644 index e69de29b..00000000 -- Gitee From d7be74292e1a6630932f0011c7cee6f3079b6e01 Mon Sep 17 00:00:00 2001 From: Dong <15469868+dong432@user.noreply.gitee.com> Date: Thu, 27 Feb 2025 02:38:17 +0000 Subject: [PATCH 08/37] update Xzt/Program.cs. Signed-off-by: Dong <15469868+dong432@user.noreply.gitee.com> --- Xzt/Program.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Xzt/Program.cs b/Xzt/Program.cs index 3751555c..4c2d44bf 100644 --- a/Xzt/Program.cs +++ b/Xzt/Program.cs @@ -1,2 +1,3 @@ -// See https://aka.ms/new-console-template for more information +// See https://aka.ms/new-console-template for more information Console.WriteLine("Hello, World!"); +Console.WriteLine("Hello, World!"); \ No newline at end of file -- Gitee From 05d00ca296fb62dc57f9d2927c4d6f1519787024 Mon Sep 17 00:00:00 2001 From: lmr <3533367613@qq.com> Date: Fri, 28 Feb 2025 16:18:27 +0800 Subject: [PATCH 09/37] =?UTF-8?q?=E9=9B=B7=E6=98=8E=E8=8A=AE=E7=AC=AC?= =?UTF-8?q?=E4=B8=80=E6=AC=A1=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Xzt/Program.cs | 3 ++- lmr/helloworld.txt | 0 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 lmr/helloworld.txt diff --git a/Xzt/Program.cs b/Xzt/Program.cs index 3751555c..4c2d44bf 100644 --- a/Xzt/Program.cs +++ b/Xzt/Program.cs @@ -1,2 +1,3 @@ -// See https://aka.ms/new-console-template for more information +// See https://aka.ms/new-console-template for more information Console.WriteLine("Hello, World!"); +Console.WriteLine("Hello, World!"); \ No newline at end of file diff --git a/lmr/helloworld.txt b/lmr/helloworld.txt new file mode 100644 index 00000000..e69de29b -- Gitee From 0707d602dade8b58054a844d63a3f2b8a203f5d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E6=A2=93=E6=A1=90?= <2399703480@qq.com> Date: Fri, 28 Feb 2025 08:32:01 +0000 Subject: [PATCH 10/37] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=96=87=E4=BB=B6=20Xz?= =?UTF-8?q?t?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Xzt/Program.cs | 3 --- 1 file changed, 3 deletions(-) delete mode 100644 Xzt/Program.cs diff --git a/Xzt/Program.cs b/Xzt/Program.cs deleted file mode 100644 index 4c2d44bf..00000000 --- a/Xzt/Program.cs +++ /dev/null @@ -1,3 +0,0 @@ -// See https://aka.ms/new-console-template for more information -Console.WriteLine("Hello, World!"); -Console.WriteLine("Hello, World!"); \ No newline at end of file -- Gitee From fdfa48513cc7352f63b899fa5bb32a5feca15bac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E6=A2=93=E6=A1=90?= <2399703480@qq.com> Date: Fri, 28 Feb 2025 16:33:39 +0800 Subject: [PATCH 11/37] =?UTF-8?q?Xzt=E7=9A=84=E7=AC=AC=E4=B8=80=E6=AC=A1?= =?UTF-8?q?=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Xzt/Program.cs | 3 --- 1 file changed, 3 deletions(-) delete mode 100644 Xzt/Program.cs diff --git a/Xzt/Program.cs b/Xzt/Program.cs deleted file mode 100644 index 4c2d44bf..00000000 --- a/Xzt/Program.cs +++ /dev/null @@ -1,3 +0,0 @@ -// See https://aka.ms/new-console-template for more information -Console.WriteLine("Hello, World!"); -Console.WriteLine("Hello, World!"); \ No newline at end of file -- Gitee From 8878796a65bcfac16a322c23fca5ebe9fea78c5d Mon Sep 17 00:00:00 2001 From: "qiyueliuhuo@1234" <654510562@qq.com> Date: Fri, 28 Feb 2025 16:35:34 +0800 Subject: [PATCH 12/37] =?UTF-8?q?=E5=88=98=E6=AD=A3=E5=90=AF=E7=9A=84?= =?UTF-8?q?=E7=AC=AC=E4=B8=80=E6=AC=A1=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- LZQ/Program.cs | 1 + 1 file changed, 1 insertion(+) create mode 100644 LZQ/Program.cs diff --git a/LZQ/Program.cs b/LZQ/Program.cs new file mode 100644 index 00000000..1bc52a60 --- /dev/null +++ b/LZQ/Program.cs @@ -0,0 +1 @@ +Console.WriteLine("Hello, World!"); -- Gitee From bb887aa90088e409e4e950129ddacab0eecc5e0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=91=E6=80=9D=E4=BB=99?= <3573804258@qq.com> Date: Mon, 17 Mar 2025 14:22:57 +0000 Subject: [PATCH 13/37] =?UTF-8?q?=E6=96=B0=E5=BB=BA=20Zsx?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Zsx/.keep | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 Zsx/.keep diff --git a/Zsx/.keep b/Zsx/.keep new file mode 100644 index 00000000..e69de29b -- Gitee From 0d6ab171e4b8052c0610d58d1cdc241cc18c53ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=91=E6=80=9D=E4=BB=99?= <3573804258@qq.com> Date: Mon, 17 Mar 2025 14:24:06 +0000 Subject: [PATCH 14/37] =?UTF-8?q?rename=20Zsx/.keep=20to=20Zsx/=E5=AE=9E?= =?UTF-8?q?=E9=AA=8C1.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 郑思仙 <3573804258@qq.com> --- Zsx/.keep | 0 "Zsx/\345\256\236\351\252\2141" | 14 ++++++++++++++ 2 files changed, 14 insertions(+) delete mode 100644 Zsx/.keep create mode 100644 "Zsx/\345\256\236\351\252\2141" diff --git a/Zsx/.keep b/Zsx/.keep deleted file mode 100644 index e69de29b..00000000 diff --git "a/Zsx/\345\256\236\351\252\2141" "b/Zsx/\345\256\236\351\252\2141" new file mode 100644 index 00000000..aea868a4 --- /dev/null +++ "b/Zsx/\345\256\236\351\252\2141" @@ -0,0 +1,14 @@ +using System; +class Program +//不使用临时变量 +{ + static void Main() + { + int n1 = 10, n2 = 20; + Console.WriteLine($"n1={n1}, n2={n2}"); + n1 = n1 + n2; + n2 = n1 - n2; + n1 = n1 - n2; + Console.WriteLine($"n1={n1}, n2={n2}"); + } +} \ No newline at end of file -- Gitee From 0919834b929f0287cd7ebc18cc264c5029131aa1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=91=E6=80=9D=E4=BB=99?= <3573804258@qq.com> Date: Mon, 17 Mar 2025 14:24:21 +0000 Subject: [PATCH 15/37] =?UTF-8?q?rename=20Zsx/=E5=AE=9E=E9=AA=8C1=20to=20Z?= =?UTF-8?q?sx/=E5=AE=9E=E9=AA=8C1.cs.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 郑思仙 <3573804258@qq.com> --- .../\345\256\236\351\252\2141.cs" | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename "Zsx/\345\256\236\351\252\2141" => "Zsx/\345\256\236\351\252\2141.cs" (100%) diff --git "a/Zsx/\345\256\236\351\252\2141" "b/Zsx/\345\256\236\351\252\2141.cs" similarity index 100% rename from "Zsx/\345\256\236\351\252\2141" rename to "Zsx/\345\256\236\351\252\2141.cs" -- Gitee From 5470904c25132db8c9b71445f80960a59b24610f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=91=E6=80=9D=E4=BB=99?= <3573804258@qq.com> Date: Mon, 17 Mar 2025 14:24:50 +0000 Subject: [PATCH 16/37] =?UTF-8?q?rename=20Zsx/=E5=AE=9E=E9=AA=8C1.cs=20to?= =?UTF-8?q?=20Zsx/1.cs.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 郑思仙 <3573804258@qq.com> --- "Zsx/\345\256\236\351\252\2141.cs" => Zsx/1.cs | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename "Zsx/\345\256\236\351\252\2141.cs" => Zsx/1.cs (100%) diff --git "a/Zsx/\345\256\236\351\252\2141.cs" b/Zsx/1.cs similarity index 100% rename from "Zsx/\345\256\236\351\252\2141.cs" rename to Zsx/1.cs -- Gitee From 13e22d71a696932128f317bf7c76873ce3850f69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=91=E6=80=9D=E4=BB=99?= <3573804258@qq.com> Date: Mon, 17 Mar 2025 14:27:20 +0000 Subject: [PATCH 17/37] add Zsx/2.cs. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 郑思仙 <3573804258@qq.com> --- Zsx/2.cs | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 Zsx/2.cs diff --git a/Zsx/2.cs b/Zsx/2.cs new file mode 100644 index 00000000..8f8bc411 --- /dev/null +++ b/Zsx/2.cs @@ -0,0 +1,38 @@ +using System; + +class Calculator +{ + static void Main() + { + Console.WriteLine("请输入第一个整数a:"); + string inputA = Console.ReadLine(); + int a; + while (!int.TryParse(inputA, out a)) + { + + Console.WriteLine("输入的不是有效的整数,请重新输入a:"); + inputA = Console.ReadLine(); + } + + + Console.WriteLine("请输入第二个整数b:"); + string inputB = Console.ReadLine(); + int b; + while (!int.TryParse(inputB, out b)) + { + Console.WriteLine("输入的不是有效的整数,请重新输入b:"); + inputB = Console.ReadLine(); + } + int add, sub, mul, div; + Calculate(a, b, out add, out sub, out mul, out div); + Console.WriteLine($"结果是:{a}+{b}={add}, {a}-{b}={sub}, {a}*{b}={mul}, {a}/{b}={div}"); + } + + static void Calculate(int x, int y, out int add, out int sub, out int mul, out int div) + { + add = x + y; + sub = x - y; + mul = x * y; + div = y != 0 ? x / y : 0; + } +} \ No newline at end of file -- Gitee From 7a1bf9ce91aba3c810defe64e9fe6b38528f9513 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=91=E6=80=9D=E4=BB=99?= <3573804258@qq.com> Date: Mon, 17 Mar 2025 14:34:35 +0000 Subject: [PATCH 18/37] add Zsx/3.cs. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 郑思仙 <3573804258@qq.com> --- Zsx/3.cs | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 Zsx/3.cs diff --git a/Zsx/3.cs b/Zsx/3.cs new file mode 100644 index 00000000..8c7fd218 --- /dev/null +++ b/Zsx/3.cs @@ -0,0 +1,40 @@ +using System; + +class Calculator +{ + static void Main() + { + + Console.WriteLine("请输入第一个整数a:"); + string inputA = Console.ReadLine(); + int a; + while (!int.TryParse(inputA, out a)) + { + // 如果转换失败,提示用户重新输入 + Console.WriteLine("输入的不是有效的整数,请重新输入a:"); + inputA = Console.ReadLine(); + } + Console.WriteLine("请输入第二个整数b:"); + + // 读取用户输入并尝试转换为整数 + string inputB = Console.ReadLine(); + int b; + while (!int.TryParse(inputB, out b)) + { + // 如果转换失败,提示用户重新输入 + Console.WriteLine("输入的不是有效的整数,请重新输入b:"); + inputB = Console.ReadLine(); + } + int add, sub, mul, div; + Calculate(a, b, out add, out sub, out mul, out div); + Console.WriteLine($"结果:{a}+{b}={add}, {a}-{b}={sub}, {a}*{b}={mul}, {a}/{b}={div}"); + } + + static void Calculate(int x, int y, out int add, out int sub, out int mul, out int div) + { + add = x + y; + sub = x - y; + mul = x * y; + div = y != 0 ? x / y : 0; + } +} -- Gitee From df949a189360751e5c0a045367ff17c017ab5f3d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=91=E6=80=9D=E4=BB=99?= <3573804258@qq.com> Date: Mon, 17 Mar 2025 14:35:05 +0000 Subject: [PATCH 19/37] add Zsx/4.cs. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 郑思仙 <3573804258@qq.com> --- Zsx/4.cs | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 Zsx/4.cs diff --git a/Zsx/4.cs b/Zsx/4.cs new file mode 100644 index 00000000..e1ac5f80 --- /dev/null +++ b/Zsx/4.cs @@ -0,0 +1,25 @@ +using System; + +class MaxValueFinder +{ + static void Main() + { + int[] numbers = { 12, 45, 7, 23, 55, 34 }; + // 遍历数组并打印每个元素 + foreach (int number in numbers) + { + Console.WriteLine(number); + } + int max = GetMax(numbers); + Console.WriteLine($"最大值:{max}"); + } + + static int GetMax(params int[] nums) + { + if (nums.Length == 0) throw new ArgumentException("数组不能为空"); + int max = nums[0]; + foreach (int num in nums) + if (num > max) max = num; + return max; + } +} \ No newline at end of file -- Gitee From 0505cbab413755d315bc838eb04948a4ef29df1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=91=E6=80=9D=E4=BB=99?= <3573804258@qq.com> Date: Mon, 17 Mar 2025 14:35:40 +0000 Subject: [PATCH 20/37] add Zsx/5.cs. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 郑思仙 <3573804258@qq.com> --- Zsx/5.cs | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 Zsx/5.cs diff --git a/Zsx/5.cs b/Zsx/5.cs new file mode 100644 index 00000000..516dffb1 --- /dev/null +++ b/Zsx/5.cs @@ -0,0 +1,25 @@ +using System; + +class FibonacciSum +{ + static void Main() + { + int n = 20; + int sum = Fibonacci(n); + Console.WriteLine($"斐波那契前{n}项和:{sum}"); + } + + static int Fibonacci(int n) + { + if (n < 1) return 0; + int a = 0, b = 1, sum = 0; + for (int i = 1; i <= n; i++) + { + sum += b; + int temp = a; + a = b; + b = temp + b; + } + return sum; + } +} \ No newline at end of file -- Gitee From fc71a53f4a323da699bca6eb6aec1aa4e0bc089c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=91=E6=80=9D=E4=BB=99?= <3573804258@qq.com> Date: Mon, 17 Mar 2025 14:38:00 +0000 Subject: [PATCH 21/37] 6 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 郑思仙 <3573804258@qq.com> --- Zsx/6.cs | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 Zsx/6.cs diff --git a/Zsx/6.cs b/Zsx/6.cs new file mode 100644 index 00000000..3e60a84b --- /dev/null +++ b/Zsx/6.cs @@ -0,0 +1,30 @@ +using System; + +class YanghuiTriangle +{ + static void Main() + { + int rows = 10; + PrintYanghuiTriangle(rows); + } + + static void PrintYanghuiTriangle(int rows) + { + int[,] triangle = new int[rows, rows]; + for (int i = 0; i < rows; i++) + { + triangle[i, 0] = 1; + triangle[i, i] = 1; + for (int j = 1; j < i; j++) + triangle[i, j] = triangle[i - 1, j - 1] + triangle[i - 1, j]; + } + + for (int i = 0; i < rows; i++) + { + Console.Write(new string(' ', rows - i - 1)); + for (int j = 0; j <= i; j++) + Console.Write($"{triangle[i, j]} "); + Console.WriteLine(); + } + } +} -- Gitee From 9ed7554f3de8a58d58a90de7c6233b1b9a08e3b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=91=E6=80=9D=E4=BB=99?= <3573804258@qq.com> Date: Mon, 17 Mar 2025 14:38:49 +0000 Subject: [PATCH 22/37] =?UTF-8?q?=E5=AE=9E=E9=AA=8C1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 郑思仙 <3573804258@qq.com> --- Zsx/10.cs | 16 ++++++++++++++ Zsx/11.cs | 64 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ Zsx/7.cs | 35 ++++++++++++++++++++++++++++++ Zsx/8.cs | 18 ++++++++++++++++ Zsx/9.cs | 11 ++++++++++ 5 files changed, 144 insertions(+) create mode 100644 Zsx/10.cs create mode 100644 Zsx/11.cs create mode 100644 Zsx/7.cs create mode 100644 Zsx/8.cs create mode 100644 Zsx/9.cs diff --git a/Zsx/10.cs b/Zsx/10.cs new file mode 100644 index 00000000..b7d216f9 --- /dev/null +++ b/Zsx/10.cs @@ -0,0 +1,16 @@ +using System; + +class StringFormatter +{ + static void Main() + { + string str = " Hello World! 你好 世界! "; + string result = ProcessString(str); + Console.WriteLine($"处理后:'{result}'"); + } + + static string ProcessString(string str) + { + return System.Text.RegularExpressions.Regex.Replace(str.Trim(), @"\s+", " "); + } +} diff --git a/Zsx/11.cs b/Zsx/11.cs new file mode 100644 index 00000000..88c957fb --- /dev/null +++ b/Zsx/11.cs @@ -0,0 +1,64 @@ +using System; + +class RockPaperScissors +{ + // 定义手势枚举类型 + public enum Gesture + { + 石头, + 剪刀, + 布 + } + + static void Main() + { + Random rand = new Random(); + int userScore = 0, computerScore = 0; + Gesture[] validGestures = (Gesture[])Enum.GetValues(typeof(Gesture)); // 获取所有枚举值 + + while (true) + { + Console.Write("请输入您的选择(石头/剪刀/布)或输入'退出'结束游戏:"); + string input = Console.ReadLine().Trim(); + + if (input.Equals("退出", StringComparison.OrdinalIgnoreCase)) + { + Console.WriteLine($"游戏结束!最终比分:玩家 {userScore} - {computerScore} 电脑"); + break; + } + + // 显式指定枚举类型参数 + if (!Enum.TryParse(input, true, out Gesture gesture) || + !Enum.IsDefined(typeof(Gesture), gesture)) + { + Console.WriteLine("无效输入,请重新输入!"); + continue; + } + + int computerChoice = rand.Next(validGestures.Length); + Gesture computerGesture = validGestures[computerChoice]; + + Console.WriteLine($"您出了:{gesture} 电脑出了:{computerGesture}"); + + // 使用枚举比较提升可读性 + if (gesture == computerGesture) + Console.WriteLine("平局!"); + else if ( + (gesture == Gesture.石头 && computerGesture == Gesture.剪刀) || + (gesture == Gesture.剪刀 && computerGesture == Gesture.布) || + (gesture == Gesture.布 && computerGesture == Gesture.石头) + ) + { + Console.WriteLine("你赢了!"); + userScore++; + } + else + { + Console.WriteLine("电脑赢了!"); + computerScore++; + } + + Console.WriteLine($"当前比分:玩家 {userScore} - {computerScore} 电脑\n"); + } + } +} diff --git a/Zsx/7.cs b/Zsx/7.cs new file mode 100644 index 00000000..4547522d --- /dev/null +++ b/Zsx/7.cs @@ -0,0 +1,35 @@ +using System; + +class BubbleSort +{ + static void Main() + { + int[] arr = { 20, 16, 78, 61, 12, 99, 57, 34, 8 }; + foreach (int number in arr) + { + Console.WriteLine(number); + } + //打印原始数组 + Bubble(arr); + Console.WriteLine("排序结果:" + string.Join(", ", arr)); + } + + static void Bubble(int[] arr) + { + bool swapped; + for (int i = 0; i < arr.Length - 1; i++) + { + swapped = false; + for (int j = 0; j < arr.Length - 1 - i; j++) + if (arr[j] > arr[j + 1]) + { + int temp = arr[j]; + arr[j] = arr[j + 1]; + arr[j + 1] = temp; + swapped = true; + } + if (!swapped) break; + } + } +} + diff --git a/Zsx/8.cs b/Zsx/8.cs new file mode 100644 index 00000000..b77e9abe --- /dev/null +++ b/Zsx/8.cs @@ -0,0 +1,18 @@ +using System; + +class CoughCounter +{ + static void Main() + { + string dialogue = "患者:“大夫,我咳嗽得很重。” 大夫:“你多大年记?” 患者:“七十五岁。” 大夫:“二十岁咳嗽吗”患者:“不咳嗽。” 大夫:“四十岁时咳嗽吗?” 患者:“也不咳嗽。” 大夫:“那现在不咳嗽,还要等到什么时咳嗽?”\"。"; + Console.WriteLine(dialogue); + int index = 0, count = 0; + while ((index = dialogue.IndexOf("咳嗽", index)) != -1) + { + count++; + Console.WriteLine($"第{count}次出现:位置{index}"); + index += 2; + } + Console.WriteLine($"总计出现:{count}次"); + } +} diff --git a/Zsx/9.cs b/Zsx/9.cs new file mode 100644 index 00000000..521118aa --- /dev/null +++ b/Zsx/9.cs @@ -0,0 +1,11 @@ +using System; + +class DateParser +{ + static void Main() + { + string dateStr = "2020年10月1日"; + string[] parts = dateStr.Split(new[] { '年', '月', '日' }, StringSplitOptions.None); + Console.WriteLine($"年:{parts[0]} 月:{parts[1]} 日:{parts[2]}"); + } +} -- Gitee From a3b12eeec786bebc7000ab6faa6c5a3f347bc240 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=91=E6=80=9D=E4=BB=99?= <3573804258@qq.com> Date: Mon, 17 Mar 2025 14:54:21 +0000 Subject: [PATCH 23/37] =?UTF-8?q?=E6=96=B0=E5=BB=BA=20=E5=AE=9E=E9=AA=8C1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- "Zsx/\345\256\236\351\252\2141/.keep" | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 "Zsx/\345\256\236\351\252\2141/.keep" diff --git "a/Zsx/\345\256\236\351\252\2141/.keep" "b/Zsx/\345\256\236\351\252\2141/.keep" new file mode 100644 index 00000000..e69de29b -- Gitee From 4827a9927e29d54b260e6aad3bfa2ddd3bfd6486 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=91=E6=80=9D=E4=BB=99?= <3573804258@qq.com> Date: Mon, 17 Mar 2025 14:56:54 +0000 Subject: [PATCH 24/37] =?UTF-8?q?rename=20Zsx/=E5=AE=9E=E9=AA=8C1/.keep=20?= =?UTF-8?q?to=20Zsx/=E5=AE=9E=E9=AA=8C1/2.cs.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 郑思仙 <3573804258@qq.com> --- "Zsx/\345\256\236\351\252\2141/.keep" | 0 "Zsx/\345\256\236\351\252\2141/2.cs" | 38 +++++++++++++++++++++++++++ 2 files changed, 38 insertions(+) delete mode 100644 "Zsx/\345\256\236\351\252\2141/.keep" create mode 100644 "Zsx/\345\256\236\351\252\2141/2.cs" diff --git "a/Zsx/\345\256\236\351\252\2141/.keep" "b/Zsx/\345\256\236\351\252\2141/.keep" deleted file mode 100644 index e69de29b..00000000 diff --git "a/Zsx/\345\256\236\351\252\2141/2.cs" "b/Zsx/\345\256\236\351\252\2141/2.cs" new file mode 100644 index 00000000..1fbfcfe4 --- /dev/null +++ "b/Zsx/\345\256\236\351\252\2141/2.cs" @@ -0,0 +1,38 @@ +using System; + +class Calculator +{ + static void Main() + { + Console.WriteLine("请输入第一个整数a:"); + string inputA = Console.ReadLine(); + int a; + while (!int.TryParse(inputA, out a)) + { + + Console.WriteLine("输入的不是有效的整数,请重新输入a:"); + inputA = Console.ReadLine(); + } + + + Console.WriteLine("请输入第二个整数b:"); + string inputB = Console.ReadLine(); + int b; + while (!int.TryParse(inputB, out b)) + { + Console.WriteLine("输入的不是有效的整数,请重新输入b:"); + inputB = Console.ReadLine(); + } + int add, sub, mul, div; + Calculate(a, b, out add, out sub, out mul, out div); + Console.WriteLine($"结果是:{a}+{b}={add}, {a}-{b}={sub}, {a}*{b}={mul}, {a}/{b}={div}"); + } + + static void Calculate(int x, int y, out int add, out int sub, out int mul, out int div) + { + add = x + y; + sub = x - y; + mul = x * y; + div = y != 0 ? x / y : 0; + } +} -- Gitee From 3bea1f11287f5aa6871643a0bef74df5b919ba56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=91=E6=80=9D=E4=BB=99?= <3573804258@qq.com> Date: Mon, 17 Mar 2025 14:57:36 +0000 Subject: [PATCH 25/37] =?UTF-8?q?=E5=AE=9E=E9=AA=8C1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 郑思仙 <3573804258@qq.com> --- "Zsx/\345\256\236\351\252\2141/1.cs" | 14 ++++++ "Zsx/\345\256\236\351\252\2141/10.cs" | 16 +++++++ "Zsx/\345\256\236\351\252\2141/11.cs" | 64 +++++++++++++++++++++++++++ "Zsx/\345\256\236\351\252\2141/3.cs" | 38 ++++++++++++++++ "Zsx/\345\256\236\351\252\2141/4.cs" | 25 +++++++++++ "Zsx/\345\256\236\351\252\2141/5.cs" | 25 +++++++++++ "Zsx/\345\256\236\351\252\2141/6.cs" | 30 +++++++++++++ "Zsx/\345\256\236\351\252\2141/7.cs" | 35 +++++++++++++++ "Zsx/\345\256\236\351\252\2141/8.cs" | 18 ++++++++ "Zsx/\345\256\236\351\252\2141/9.cs" | 11 +++++ 10 files changed, 276 insertions(+) create mode 100644 "Zsx/\345\256\236\351\252\2141/1.cs" create mode 100644 "Zsx/\345\256\236\351\252\2141/10.cs" create mode 100644 "Zsx/\345\256\236\351\252\2141/11.cs" create mode 100644 "Zsx/\345\256\236\351\252\2141/3.cs" create mode 100644 "Zsx/\345\256\236\351\252\2141/4.cs" create mode 100644 "Zsx/\345\256\236\351\252\2141/5.cs" create mode 100644 "Zsx/\345\256\236\351\252\2141/6.cs" create mode 100644 "Zsx/\345\256\236\351\252\2141/7.cs" create mode 100644 "Zsx/\345\256\236\351\252\2141/8.cs" create mode 100644 "Zsx/\345\256\236\351\252\2141/9.cs" diff --git "a/Zsx/\345\256\236\351\252\2141/1.cs" "b/Zsx/\345\256\236\351\252\2141/1.cs" new file mode 100644 index 00000000..d22097af --- /dev/null +++ "b/Zsx/\345\256\236\351\252\2141/1.cs" @@ -0,0 +1,14 @@ +using System; +class Program +//不使用临时变量 +{ + static void Main() + { + int n1 = 10, n2 = 20; + Console.WriteLine($"n1={n1}, n2={n2}"); + n1 = n1 + n2; + n2 = n1 - n2; + n1 = n1 - n2; + Console.WriteLine($"n1={n1}, n2={n2}"); + } +} diff --git "a/Zsx/\345\256\236\351\252\2141/10.cs" "b/Zsx/\345\256\236\351\252\2141/10.cs" new file mode 100644 index 00000000..b7d216f9 --- /dev/null +++ "b/Zsx/\345\256\236\351\252\2141/10.cs" @@ -0,0 +1,16 @@ +using System; + +class StringFormatter +{ + static void Main() + { + string str = " Hello World! 你好 世界! "; + string result = ProcessString(str); + Console.WriteLine($"处理后:'{result}'"); + } + + static string ProcessString(string str) + { + return System.Text.RegularExpressions.Regex.Replace(str.Trim(), @"\s+", " "); + } +} diff --git "a/Zsx/\345\256\236\351\252\2141/11.cs" "b/Zsx/\345\256\236\351\252\2141/11.cs" new file mode 100644 index 00000000..88c957fb --- /dev/null +++ "b/Zsx/\345\256\236\351\252\2141/11.cs" @@ -0,0 +1,64 @@ +using System; + +class RockPaperScissors +{ + // 定义手势枚举类型 + public enum Gesture + { + 石头, + 剪刀, + 布 + } + + static void Main() + { + Random rand = new Random(); + int userScore = 0, computerScore = 0; + Gesture[] validGestures = (Gesture[])Enum.GetValues(typeof(Gesture)); // 获取所有枚举值 + + while (true) + { + Console.Write("请输入您的选择(石头/剪刀/布)或输入'退出'结束游戏:"); + string input = Console.ReadLine().Trim(); + + if (input.Equals("退出", StringComparison.OrdinalIgnoreCase)) + { + Console.WriteLine($"游戏结束!最终比分:玩家 {userScore} - {computerScore} 电脑"); + break; + } + + // 显式指定枚举类型参数 + if (!Enum.TryParse(input, true, out Gesture gesture) || + !Enum.IsDefined(typeof(Gesture), gesture)) + { + Console.WriteLine("无效输入,请重新输入!"); + continue; + } + + int computerChoice = rand.Next(validGestures.Length); + Gesture computerGesture = validGestures[computerChoice]; + + Console.WriteLine($"您出了:{gesture} 电脑出了:{computerGesture}"); + + // 使用枚举比较提升可读性 + if (gesture == computerGesture) + Console.WriteLine("平局!"); + else if ( + (gesture == Gesture.石头 && computerGesture == Gesture.剪刀) || + (gesture == Gesture.剪刀 && computerGesture == Gesture.布) || + (gesture == Gesture.布 && computerGesture == Gesture.石头) + ) + { + Console.WriteLine("你赢了!"); + userScore++; + } + else + { + Console.WriteLine("电脑赢了!"); + computerScore++; + } + + Console.WriteLine($"当前比分:玩家 {userScore} - {computerScore} 电脑\n"); + } + } +} diff --git "a/Zsx/\345\256\236\351\252\2141/3.cs" "b/Zsx/\345\256\236\351\252\2141/3.cs" new file mode 100644 index 00000000..9963990f --- /dev/null +++ "b/Zsx/\345\256\236\351\252\2141/3.cs" @@ -0,0 +1,38 @@ +using System; + +class Calculator +{ + static void Main() + { + Console.WriteLine("请输入第一个整数a:"); + string inputA = Console.ReadLine(); + int a; + while (!int.TryParse(inputA, out a)) + { + + Console.WriteLine("输入的不是有效的整数,请重新输入a:"); + inputA = Console.ReadLine(); + } + + + Console.WriteLine("请输入第二个整数b:"); + string inputB = Console.ReadLine(); + int b; + while (!int.TryParse(inputB, out b)) + { + Console.WriteLine("输入的不是有效的整数,请重新输入b:"); + inputB = Console.ReadLine(); + } + int add, sub, mul, div; + Calculate(a, b, out add, out sub, out mul, out div); + Console.WriteLine($"结果是:{a}+{b}={add}, {a}-{b}={sub}, {a}*{b}={mul}, {a}/{b}={div}"); + } + + static void Calculate(int x, int y, out int add, out int sub, out int mul, out int div) + { + add = x + y; + sub = x - y; + mul = x * y; + div = y != 0 ? x / y : 0; + } +} diff --git "a/Zsx/\345\256\236\351\252\2141/4.cs" "b/Zsx/\345\256\236\351\252\2141/4.cs" new file mode 100644 index 00000000..7f147d84 --- /dev/null +++ "b/Zsx/\345\256\236\351\252\2141/4.cs" @@ -0,0 +1,25 @@ +using System; + +class MaxValueFinder +{ + static void Main() + { + int[] numbers = { 12, 45, 7, 23, 55, 34 }; + // 遍历数组并打印每个元素 + foreach (int number in numbers) + { + Console.WriteLine(number); + } + int max = GetMax(numbers); + Console.WriteLine($"最大值:{max}"); + } + + static int GetMax(params int[] nums) + { + if (nums.Length == 0) throw new ArgumentException("数组不能为空"); + int max = nums[0]; + foreach (int num in nums) + if (num > max) max = num; + return max; + } +} diff --git "a/Zsx/\345\256\236\351\252\2141/5.cs" "b/Zsx/\345\256\236\351\252\2141/5.cs" new file mode 100644 index 00000000..3b7107aa --- /dev/null +++ "b/Zsx/\345\256\236\351\252\2141/5.cs" @@ -0,0 +1,25 @@ +using System; + +class FibonacciSum +{ + static void Main() + { + int n = 20; + int sum = Fibonacci(n); + Console.WriteLine($"斐波那契前{n}项和:{sum}"); + } + + static int Fibonacci(int n) + { + if (n < 1) return 0; + int a = 0, b = 1, sum = 0; + for (int i = 1; i <= n; i++) + { + sum += b; + int temp = a; + a = b; + b = temp + b; + } + return sum; + } +} diff --git "a/Zsx/\345\256\236\351\252\2141/6.cs" "b/Zsx/\345\256\236\351\252\2141/6.cs" new file mode 100644 index 00000000..3e60a84b --- /dev/null +++ "b/Zsx/\345\256\236\351\252\2141/6.cs" @@ -0,0 +1,30 @@ +using System; + +class YanghuiTriangle +{ + static void Main() + { + int rows = 10; + PrintYanghuiTriangle(rows); + } + + static void PrintYanghuiTriangle(int rows) + { + int[,] triangle = new int[rows, rows]; + for (int i = 0; i < rows; i++) + { + triangle[i, 0] = 1; + triangle[i, i] = 1; + for (int j = 1; j < i; j++) + triangle[i, j] = triangle[i - 1, j - 1] + triangle[i - 1, j]; + } + + for (int i = 0; i < rows; i++) + { + Console.Write(new string(' ', rows - i - 1)); + for (int j = 0; j <= i; j++) + Console.Write($"{triangle[i, j]} "); + Console.WriteLine(); + } + } +} diff --git "a/Zsx/\345\256\236\351\252\2141/7.cs" "b/Zsx/\345\256\236\351\252\2141/7.cs" new file mode 100644 index 00000000..4547522d --- /dev/null +++ "b/Zsx/\345\256\236\351\252\2141/7.cs" @@ -0,0 +1,35 @@ +using System; + +class BubbleSort +{ + static void Main() + { + int[] arr = { 20, 16, 78, 61, 12, 99, 57, 34, 8 }; + foreach (int number in arr) + { + Console.WriteLine(number); + } + //打印原始数组 + Bubble(arr); + Console.WriteLine("排序结果:" + string.Join(", ", arr)); + } + + static void Bubble(int[] arr) + { + bool swapped; + for (int i = 0; i < arr.Length - 1; i++) + { + swapped = false; + for (int j = 0; j < arr.Length - 1 - i; j++) + if (arr[j] > arr[j + 1]) + { + int temp = arr[j]; + arr[j] = arr[j + 1]; + arr[j + 1] = temp; + swapped = true; + } + if (!swapped) break; + } + } +} + diff --git "a/Zsx/\345\256\236\351\252\2141/8.cs" "b/Zsx/\345\256\236\351\252\2141/8.cs" new file mode 100644 index 00000000..b77e9abe --- /dev/null +++ "b/Zsx/\345\256\236\351\252\2141/8.cs" @@ -0,0 +1,18 @@ +using System; + +class CoughCounter +{ + static void Main() + { + string dialogue = "患者:“大夫,我咳嗽得很重。” 大夫:“你多大年记?” 患者:“七十五岁。” 大夫:“二十岁咳嗽吗”患者:“不咳嗽。” 大夫:“四十岁时咳嗽吗?” 患者:“也不咳嗽。” 大夫:“那现在不咳嗽,还要等到什么时咳嗽?”\"。"; + Console.WriteLine(dialogue); + int index = 0, count = 0; + while ((index = dialogue.IndexOf("咳嗽", index)) != -1) + { + count++; + Console.WriteLine($"第{count}次出现:位置{index}"); + index += 2; + } + Console.WriteLine($"总计出现:{count}次"); + } +} diff --git "a/Zsx/\345\256\236\351\252\2141/9.cs" "b/Zsx/\345\256\236\351\252\2141/9.cs" new file mode 100644 index 00000000..521118aa --- /dev/null +++ "b/Zsx/\345\256\236\351\252\2141/9.cs" @@ -0,0 +1,11 @@ +using System; + +class DateParser +{ + static void Main() + { + string dateStr = "2020年10月1日"; + string[] parts = dateStr.Split(new[] { '年', '月', '日' }, StringSplitOptions.None); + Console.WriteLine($"年:{parts[0]} 月:{parts[1]} 日:{parts[2]}"); + } +} -- Gitee From 2b12cd6afa20f354f86e8534e8af79f2af434511 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=91=E6=80=9D=E4=BB=99?= <3573804258@qq.com> Date: Mon, 17 Mar 2025 14:57:52 +0000 Subject: [PATCH 26/37] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=96=87=E4=BB=B6=20Zs?= =?UTF-8?q?x/1.cs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Zsx/1.cs | 14 -------------- 1 file changed, 14 deletions(-) delete mode 100644 Zsx/1.cs diff --git a/Zsx/1.cs b/Zsx/1.cs deleted file mode 100644 index aea868a4..00000000 --- a/Zsx/1.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System; -class Program -//不使用临时变量 -{ - static void Main() - { - int n1 = 10, n2 = 20; - Console.WriteLine($"n1={n1}, n2={n2}"); - n1 = n1 + n2; - n2 = n1 - n2; - n1 = n1 - n2; - Console.WriteLine($"n1={n1}, n2={n2}"); - } -} \ No newline at end of file -- Gitee From 287a62451190a1e1148d85ff56fcf69b83822399 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=91=E6=80=9D=E4=BB=99?= <3573804258@qq.com> Date: Mon, 17 Mar 2025 14:59:47 +0000 Subject: [PATCH 27/37] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=96=87=E4=BB=B6=20Zs?= =?UTF-8?q?x/9.cs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Zsx/9.cs | 11 ----------- 1 file changed, 11 deletions(-) delete mode 100644 Zsx/9.cs diff --git a/Zsx/9.cs b/Zsx/9.cs deleted file mode 100644 index 521118aa..00000000 --- a/Zsx/9.cs +++ /dev/null @@ -1,11 +0,0 @@ -using System; - -class DateParser -{ - static void Main() - { - string dateStr = "2020年10月1日"; - string[] parts = dateStr.Split(new[] { '年', '月', '日' }, StringSplitOptions.None); - Console.WriteLine($"年:{parts[0]} 月:{parts[1]} 日:{parts[2]}"); - } -} -- Gitee From b1c985dfc76af67ce74b9240238dbbf908aa2159 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=91=E6=80=9D=E4=BB=99?= <3573804258@qq.com> Date: Mon, 17 Mar 2025 14:59:53 +0000 Subject: [PATCH 28/37] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=96=87=E4=BB=B6=20Zs?= =?UTF-8?q?x/10.cs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Zsx/10.cs | 16 ---------------- 1 file changed, 16 deletions(-) delete mode 100644 Zsx/10.cs diff --git a/Zsx/10.cs b/Zsx/10.cs deleted file mode 100644 index b7d216f9..00000000 --- a/Zsx/10.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System; - -class StringFormatter -{ - static void Main() - { - string str = " Hello World! 你好 世界! "; - string result = ProcessString(str); - Console.WriteLine($"处理后:'{result}'"); - } - - static string ProcessString(string str) - { - return System.Text.RegularExpressions.Regex.Replace(str.Trim(), @"\s+", " "); - } -} -- Gitee From c70c4b90778fc140544c8246a45b83a5e8d5e0b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=91=E6=80=9D=E4=BB=99?= <3573804258@qq.com> Date: Mon, 17 Mar 2025 14:59:58 +0000 Subject: [PATCH 29/37] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=96=87=E4=BB=B6=20Zs?= =?UTF-8?q?x/11.cs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Zsx/11.cs | 64 ------------------------------------------------------- 1 file changed, 64 deletions(-) delete mode 100644 Zsx/11.cs diff --git a/Zsx/11.cs b/Zsx/11.cs deleted file mode 100644 index 88c957fb..00000000 --- a/Zsx/11.cs +++ /dev/null @@ -1,64 +0,0 @@ -using System; - -class RockPaperScissors -{ - // 定义手势枚举类型 - public enum Gesture - { - 石头, - 剪刀, - 布 - } - - static void Main() - { - Random rand = new Random(); - int userScore = 0, computerScore = 0; - Gesture[] validGestures = (Gesture[])Enum.GetValues(typeof(Gesture)); // 获取所有枚举值 - - while (true) - { - Console.Write("请输入您的选择(石头/剪刀/布)或输入'退出'结束游戏:"); - string input = Console.ReadLine().Trim(); - - if (input.Equals("退出", StringComparison.OrdinalIgnoreCase)) - { - Console.WriteLine($"游戏结束!最终比分:玩家 {userScore} - {computerScore} 电脑"); - break; - } - - // 显式指定枚举类型参数 - if (!Enum.TryParse(input, true, out Gesture gesture) || - !Enum.IsDefined(typeof(Gesture), gesture)) - { - Console.WriteLine("无效输入,请重新输入!"); - continue; - } - - int computerChoice = rand.Next(validGestures.Length); - Gesture computerGesture = validGestures[computerChoice]; - - Console.WriteLine($"您出了:{gesture} 电脑出了:{computerGesture}"); - - // 使用枚举比较提升可读性 - if (gesture == computerGesture) - Console.WriteLine("平局!"); - else if ( - (gesture == Gesture.石头 && computerGesture == Gesture.剪刀) || - (gesture == Gesture.剪刀 && computerGesture == Gesture.布) || - (gesture == Gesture.布 && computerGesture == Gesture.石头) - ) - { - Console.WriteLine("你赢了!"); - userScore++; - } - else - { - Console.WriteLine("电脑赢了!"); - computerScore++; - } - - Console.WriteLine($"当前比分:玩家 {userScore} - {computerScore} 电脑\n"); - } - } -} -- Gitee From c8a08cd8a297de19bf8e05d3967e7135b66d9d49 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=91=E6=80=9D=E4=BB=99?= <3573804258@qq.com> Date: Mon, 17 Mar 2025 15:00:03 +0000 Subject: [PATCH 30/37] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=96=87=E4=BB=B6=20Zs?= =?UTF-8?q?x/2.cs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Zsx/2.cs | 38 -------------------------------------- 1 file changed, 38 deletions(-) delete mode 100644 Zsx/2.cs diff --git a/Zsx/2.cs b/Zsx/2.cs deleted file mode 100644 index 8f8bc411..00000000 --- a/Zsx/2.cs +++ /dev/null @@ -1,38 +0,0 @@ -using System; - -class Calculator -{ - static void Main() - { - Console.WriteLine("请输入第一个整数a:"); - string inputA = Console.ReadLine(); - int a; - while (!int.TryParse(inputA, out a)) - { - - Console.WriteLine("输入的不是有效的整数,请重新输入a:"); - inputA = Console.ReadLine(); - } - - - Console.WriteLine("请输入第二个整数b:"); - string inputB = Console.ReadLine(); - int b; - while (!int.TryParse(inputB, out b)) - { - Console.WriteLine("输入的不是有效的整数,请重新输入b:"); - inputB = Console.ReadLine(); - } - int add, sub, mul, div; - Calculate(a, b, out add, out sub, out mul, out div); - Console.WriteLine($"结果是:{a}+{b}={add}, {a}-{b}={sub}, {a}*{b}={mul}, {a}/{b}={div}"); - } - - static void Calculate(int x, int y, out int add, out int sub, out int mul, out int div) - { - add = x + y; - sub = x - y; - mul = x * y; - div = y != 0 ? x / y : 0; - } -} \ No newline at end of file -- Gitee From 0db32b4e94d6bc56f4ddecd1f64a2ad9ce70e1c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=91=E6=80=9D=E4=BB=99?= <3573804258@qq.com> Date: Mon, 17 Mar 2025 15:00:11 +0000 Subject: [PATCH 31/37] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=96=87=E4=BB=B6=20Zs?= =?UTF-8?q?x/3.cs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Zsx/3.cs | 40 ---------------------------------------- 1 file changed, 40 deletions(-) delete mode 100644 Zsx/3.cs diff --git a/Zsx/3.cs b/Zsx/3.cs deleted file mode 100644 index 8c7fd218..00000000 --- a/Zsx/3.cs +++ /dev/null @@ -1,40 +0,0 @@ -using System; - -class Calculator -{ - static void Main() - { - - Console.WriteLine("请输入第一个整数a:"); - string inputA = Console.ReadLine(); - int a; - while (!int.TryParse(inputA, out a)) - { - // 如果转换失败,提示用户重新输入 - Console.WriteLine("输入的不是有效的整数,请重新输入a:"); - inputA = Console.ReadLine(); - } - Console.WriteLine("请输入第二个整数b:"); - - // 读取用户输入并尝试转换为整数 - string inputB = Console.ReadLine(); - int b; - while (!int.TryParse(inputB, out b)) - { - // 如果转换失败,提示用户重新输入 - Console.WriteLine("输入的不是有效的整数,请重新输入b:"); - inputB = Console.ReadLine(); - } - int add, sub, mul, div; - Calculate(a, b, out add, out sub, out mul, out div); - Console.WriteLine($"结果:{a}+{b}={add}, {a}-{b}={sub}, {a}*{b}={mul}, {a}/{b}={div}"); - } - - static void Calculate(int x, int y, out int add, out int sub, out int mul, out int div) - { - add = x + y; - sub = x - y; - mul = x * y; - div = y != 0 ? x / y : 0; - } -} -- Gitee From 54c7ce0a65dc0c6f2d0e8b85090f9fb7341e9cbc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=91=E6=80=9D=E4=BB=99?= <3573804258@qq.com> Date: Mon, 17 Mar 2025 15:00:18 +0000 Subject: [PATCH 32/37] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=96=87=E4=BB=B6=20Zs?= =?UTF-8?q?x/4.cs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Zsx/4.cs | 25 ------------------------- 1 file changed, 25 deletions(-) delete mode 100644 Zsx/4.cs diff --git a/Zsx/4.cs b/Zsx/4.cs deleted file mode 100644 index e1ac5f80..00000000 --- a/Zsx/4.cs +++ /dev/null @@ -1,25 +0,0 @@ -using System; - -class MaxValueFinder -{ - static void Main() - { - int[] numbers = { 12, 45, 7, 23, 55, 34 }; - // 遍历数组并打印每个元素 - foreach (int number in numbers) - { - Console.WriteLine(number); - } - int max = GetMax(numbers); - Console.WriteLine($"最大值:{max}"); - } - - static int GetMax(params int[] nums) - { - if (nums.Length == 0) throw new ArgumentException("数组不能为空"); - int max = nums[0]; - foreach (int num in nums) - if (num > max) max = num; - return max; - } -} \ No newline at end of file -- Gitee From 2de4746ab45875ed5f5f8ea659054fe5f1e80d16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=91=E6=80=9D=E4=BB=99?= <3573804258@qq.com> Date: Mon, 17 Mar 2025 15:01:50 +0000 Subject: [PATCH 33/37] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=96=87=E4=BB=B6=20Zs?= =?UTF-8?q?x/5.cs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Zsx/5.cs | 25 ------------------------- 1 file changed, 25 deletions(-) delete mode 100644 Zsx/5.cs diff --git a/Zsx/5.cs b/Zsx/5.cs deleted file mode 100644 index 516dffb1..00000000 --- a/Zsx/5.cs +++ /dev/null @@ -1,25 +0,0 @@ -using System; - -class FibonacciSum -{ - static void Main() - { - int n = 20; - int sum = Fibonacci(n); - Console.WriteLine($"斐波那契前{n}项和:{sum}"); - } - - static int Fibonacci(int n) - { - if (n < 1) return 0; - int a = 0, b = 1, sum = 0; - for (int i = 1; i <= n; i++) - { - sum += b; - int temp = a; - a = b; - b = temp + b; - } - return sum; - } -} \ No newline at end of file -- Gitee From e65acdb428e59a968d1e01b8702d4c373d378e66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=91=E6=80=9D=E4=BB=99?= <3573804258@qq.com> Date: Mon, 17 Mar 2025 15:01:55 +0000 Subject: [PATCH 34/37] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=96=87=E4=BB=B6=20Zs?= =?UTF-8?q?x/6.cs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Zsx/6.cs | 30 ------------------------------ 1 file changed, 30 deletions(-) delete mode 100644 Zsx/6.cs diff --git a/Zsx/6.cs b/Zsx/6.cs deleted file mode 100644 index 3e60a84b..00000000 --- a/Zsx/6.cs +++ /dev/null @@ -1,30 +0,0 @@ -using System; - -class YanghuiTriangle -{ - static void Main() - { - int rows = 10; - PrintYanghuiTriangle(rows); - } - - static void PrintYanghuiTriangle(int rows) - { - int[,] triangle = new int[rows, rows]; - for (int i = 0; i < rows; i++) - { - triangle[i, 0] = 1; - triangle[i, i] = 1; - for (int j = 1; j < i; j++) - triangle[i, j] = triangle[i - 1, j - 1] + triangle[i - 1, j]; - } - - for (int i = 0; i < rows; i++) - { - Console.Write(new string(' ', rows - i - 1)); - for (int j = 0; j <= i; j++) - Console.Write($"{triangle[i, j]} "); - Console.WriteLine(); - } - } -} -- Gitee From b8c7f8ce44f80d2282818595c039154a8a889d13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=91=E6=80=9D=E4=BB=99?= <3573804258@qq.com> Date: Mon, 17 Mar 2025 15:02:01 +0000 Subject: [PATCH 35/37] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=96=87=E4=BB=B6=20Zs?= =?UTF-8?q?x/7.cs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Zsx/7.cs | 35 ----------------------------------- 1 file changed, 35 deletions(-) delete mode 100644 Zsx/7.cs diff --git a/Zsx/7.cs b/Zsx/7.cs deleted file mode 100644 index 4547522d..00000000 --- a/Zsx/7.cs +++ /dev/null @@ -1,35 +0,0 @@ -using System; - -class BubbleSort -{ - static void Main() - { - int[] arr = { 20, 16, 78, 61, 12, 99, 57, 34, 8 }; - foreach (int number in arr) - { - Console.WriteLine(number); - } - //打印原始数组 - Bubble(arr); - Console.WriteLine("排序结果:" + string.Join(", ", arr)); - } - - static void Bubble(int[] arr) - { - bool swapped; - for (int i = 0; i < arr.Length - 1; i++) - { - swapped = false; - for (int j = 0; j < arr.Length - 1 - i; j++) - if (arr[j] > arr[j + 1]) - { - int temp = arr[j]; - arr[j] = arr[j + 1]; - arr[j + 1] = temp; - swapped = true; - } - if (!swapped) break; - } - } -} - -- Gitee From 4f66cf927e58cf19c7165a825add2b22b5656a06 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=91=E6=80=9D=E4=BB=99?= <3573804258@qq.com> Date: Mon, 17 Mar 2025 15:02:07 +0000 Subject: [PATCH 36/37] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=96=87=E4=BB=B6=20Zs?= =?UTF-8?q?x/8.cs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Zsx/8.cs | 18 ------------------ 1 file changed, 18 deletions(-) delete mode 100644 Zsx/8.cs diff --git a/Zsx/8.cs b/Zsx/8.cs deleted file mode 100644 index b77e9abe..00000000 --- a/Zsx/8.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System; - -class CoughCounter -{ - static void Main() - { - string dialogue = "患者:“大夫,我咳嗽得很重。” 大夫:“你多大年记?” 患者:“七十五岁。” 大夫:“二十岁咳嗽吗”患者:“不咳嗽。” 大夫:“四十岁时咳嗽吗?” 患者:“也不咳嗽。” 大夫:“那现在不咳嗽,还要等到什么时咳嗽?”\"。"; - Console.WriteLine(dialogue); - int index = 0, count = 0; - while ((index = dialogue.IndexOf("咳嗽", index)) != -1) - { - count++; - Console.WriteLine($"第{count}次出现:位置{index}"); - index += 2; - } - Console.WriteLine($"总计出现:{count}次"); - } -} -- Gitee From a44715b4288837341070218e7098607c0cf0f0c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=91=E6=80=9D=E4=BB=99?= <3573804258@qq.com> Date: Tue, 25 Mar 2025 02:54:18 +0000 Subject: [PATCH 37/37] =?UTF-8?q?update=20Zsx/=E5=AE=9E=E9=AA=8C1/2.cs.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 郑思仙 <3573804258@qq.com> --- "Zsx/\345\256\236\351\252\2141/2.cs" | 39 ++++++++-------------------- 1 file changed, 11 insertions(+), 28 deletions(-) diff --git "a/Zsx/\345\256\236\351\252\2141/2.cs" "b/Zsx/\345\256\236\351\252\2141/2.cs" index 1fbfcfe4..742b7c72 100644 --- "a/Zsx/\345\256\236\351\252\2141/2.cs" +++ "b/Zsx/\345\256\236\351\252\2141/2.cs" @@ -1,38 +1,21 @@ using System; -class Calculator +class Program { static void Main() { - Console.WriteLine("请输入第一个整数a:"); - string inputA = Console.ReadLine(); - int a; - while (!int.TryParse(inputA, out a)) - { - - Console.WriteLine("输入的不是有效的整数,请重新输入a:"); - inputA = Console.ReadLine(); - } + int n1 = 10, n2 = 20; + Console.WriteLine($"交换前:n1={n1}, n2={n2}"); - - Console.WriteLine("请输入第二个整数b:"); - string inputB = Console.ReadLine(); - int b; - while (!int.TryParse(inputB, out b)) - { - Console.WriteLine("输入的不是有效的整数,请重新输入b:"); - inputB = Console.ReadLine(); - } - int add, sub, mul, div; - Calculate(a, b, out add, out sub, out mul, out div); - Console.WriteLine($"结果是:{a}+{b}={add}, {a}-{b}={sub}, {a}*{b}={mul}, {a}/{b}={div}"); - } + // 调用Swap方法,通过ref参数直接交换原始变量 + Swap(ref n1, ref n2); - static void Calculate(int x, int y, out int add, out int sub, out int mul, out int div) + Console.WriteLine($"交换后:n1={n1}, n2={n2}"); + } + static void Swap(ref int a, ref int b) { - add = x + y; - sub = x - y; - mul = x * y; - div = y != 0 ? x / y : 0; + int temp = a; + a = b; + b = temp; } } -- Gitee