Initial commit
This commit is contained in:
10
cs3/C_Sharp_3_1/C_Sharp_3_1.csproj
Normal file
10
cs3/C_Sharp_3_1/C_Sharp_3_1.csproj
Normal file
@@ -0,0 +1,10 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
||||
25
cs3/C_Sharp_3_1/C_Sharp_3_1.sln
Normal file
25
cs3/C_Sharp_3_1/C_Sharp_3_1.sln
Normal file
@@ -0,0 +1,25 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.14.36616.10 d17.14
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "C_Sharp_3_1", "C_Sharp_3_1.csproj", "{E11A2FAE-3F54-48C2-86B8-3AB7BFC20869}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{E11A2FAE-3F54-48C2-86B8-3AB7BFC20869}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{E11A2FAE-3F54-48C2-86B8-3AB7BFC20869}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{E11A2FAE-3F54-48C2-86B8-3AB7BFC20869}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{E11A2FAE-3F54-48C2-86B8-3AB7BFC20869}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {F31B64FE-9C56-4D0A-9ACD-B8037F502CA0}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
36
cs3/C_Sharp_3_1/Program.cs
Normal file
36
cs3/C_Sharp_3_1/Program.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
using System;
|
||||
namespace C_Sharp_3_1
|
||||
{
|
||||
public class Program
|
||||
{
|
||||
static void Main()
|
||||
{
|
||||
int n = -1, result = 1, i = 1;
|
||||
Console.WriteLine("请输入一个正整数n");
|
||||
while (n < 0)
|
||||
{
|
||||
n = int.Parse(Console.ReadLine());
|
||||
}
|
||||
// For循环实现阶乘
|
||||
for (i = 1; i <= n; i++)
|
||||
{
|
||||
result *= i;
|
||||
}
|
||||
Console.WriteLine("for 循环 {0}!={1}", n, result);
|
||||
// while循环实现阶乘
|
||||
while (n > 1)
|
||||
{
|
||||
result *= n;
|
||||
n--;
|
||||
}
|
||||
Console.WriteLine("while 循环 {0}!={1}", n, result);
|
||||
//do...while循环实现阶乘
|
||||
do
|
||||
{
|
||||
result *= i;
|
||||
i ++;
|
||||
} while (i<=n);
|
||||
Console.WriteLine("do...while 循环 {0}!={1}", n, result);
|
||||
}
|
||||
}
|
||||
}
|
||||
10
cs3/C_Sharp_3_2/C_Sharp_3_2.csproj
Normal file
10
cs3/C_Sharp_3_2/C_Sharp_3_2.csproj
Normal file
@@ -0,0 +1,10 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
||||
25
cs3/C_Sharp_3_2/C_Sharp_3_2.sln
Normal file
25
cs3/C_Sharp_3_2/C_Sharp_3_2.sln
Normal file
@@ -0,0 +1,25 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.14.36616.10 d17.14
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "C_Sharp_3_2", "C_Sharp_3_2.csproj", "{5AE05804-36D4-45BB-BDD7-F4DE48D39659}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{5AE05804-36D4-45BB-BDD7-F4DE48D39659}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{5AE05804-36D4-45BB-BDD7-F4DE48D39659}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{5AE05804-36D4-45BB-BDD7-F4DE48D39659}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{5AE05804-36D4-45BB-BDD7-F4DE48D39659}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {D7D96903-C0A1-45B7-AABA-84C784E277F9}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
22
cs3/C_Sharp_3_2/Program.cs
Normal file
22
cs3/C_Sharp_3_2/Program.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
using System;
|
||||
namespace C_Sharp_3_2
|
||||
{
|
||||
public class Program
|
||||
{
|
||||
static void Main()
|
||||
{
|
||||
int f1=1, f2=1, f3, n=2;
|
||||
Console.Write("{0,5}\t{0,5}\t", f1, f2);
|
||||
f3 = f1 + f2;
|
||||
while (f3<=1000)
|
||||
{
|
||||
Console.Write("{0,5}\t", f3);
|
||||
n++;
|
||||
if (n % 5 == 0) Console.WriteLine("\n");
|
||||
f1 = f2;
|
||||
f2 = f3;
|
||||
f3 = f1 + f2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
10
cs3/C_Sharp_3_3/C_Sharp_3_3.csproj
Normal file
10
cs3/C_Sharp_3_3/C_Sharp_3_3.csproj
Normal file
@@ -0,0 +1,10 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
||||
25
cs3/C_Sharp_3_3/C_Sharp_3_3.sln
Normal file
25
cs3/C_Sharp_3_3/C_Sharp_3_3.sln
Normal file
@@ -0,0 +1,25 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.14.36616.10 d17.14
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "C_Sharp_3_3", "C_Sharp_3_3.csproj", "{C1F468F9-1857-4917-A157-4DE92BC3AD2A}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{C1F468F9-1857-4917-A157-4DE92BC3AD2A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{C1F468F9-1857-4917-A157-4DE92BC3AD2A}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{C1F468F9-1857-4917-A157-4DE92BC3AD2A}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{C1F468F9-1857-4917-A157-4DE92BC3AD2A}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {97BE73A5-1856-439E-85C5-BB65BF1F0541}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
46
cs3/C_Sharp_3_3/Program.cs
Normal file
46
cs3/C_Sharp_3_3/Program.cs
Normal file
@@ -0,0 +1,46 @@
|
||||
namespace C_Sharp_3_3
|
||||
{
|
||||
public class Program
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
int c, r;
|
||||
Console.Write("请输入总只数");
|
||||
int h = int.Parse(Console.ReadLine());
|
||||
int f = 1;
|
||||
while (f % 2 != 0)
|
||||
{
|
||||
Console.Write("请输入总脚数(必须是偶数)");
|
||||
f = int.Parse(Console.ReadLine());
|
||||
}
|
||||
// 循环
|
||||
bool solution = false;
|
||||
for (c = 0; c <= h; c++)
|
||||
{
|
||||
r = h - c;
|
||||
if (2 * c + 4 * r == f)
|
||||
{
|
||||
Console.WriteLine("方法一:鸡有{0}只,兔有{1}只", c, r);
|
||||
solution = true;
|
||||
}
|
||||
}
|
||||
if (!solution)
|
||||
{
|
||||
Console.WriteLine("方法一无解");
|
||||
}
|
||||
// 解方程
|
||||
r = f / 2 - h;
|
||||
c = h - r;
|
||||
solution = false;
|
||||
if (c >= 0 && r >= 0)
|
||||
{
|
||||
Console.WriteLine("方法二:鸡有{0}只,兔有{1}只", c, r);
|
||||
solution = true;
|
||||
}
|
||||
if (!solution)
|
||||
{
|
||||
Console.WriteLine("方法二无解");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
10
cs3/C_Sharp_3_4/C_Sharp_3_4.csproj
Normal file
10
cs3/C_Sharp_3_4/C_Sharp_3_4.csproj
Normal file
@@ -0,0 +1,10 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
||||
25
cs3/C_Sharp_3_4/C_Sharp_3_4.sln
Normal file
25
cs3/C_Sharp_3_4/C_Sharp_3_4.sln
Normal file
@@ -0,0 +1,25 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.14.36616.10 d17.14
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "C_Sharp_3_4", "C_Sharp_3_4.csproj", "{6EC9575D-0EE8-4FEA-AD71-E573233BEEF4}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{6EC9575D-0EE8-4FEA-AD71-E573233BEEF4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{6EC9575D-0EE8-4FEA-AD71-E573233BEEF4}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{6EC9575D-0EE8-4FEA-AD71-E573233BEEF4}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{6EC9575D-0EE8-4FEA-AD71-E573233BEEF4}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {8E01B379-AB7D-4A69-8843-55F63765792C}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
20
cs3/C_Sharp_3_4/Program.cs
Normal file
20
cs3/C_Sharp_3_4/Program.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using System;
|
||||
namespace C_Sharp_3_4
|
||||
{
|
||||
public class Program
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
double n = 1, t = 1, pi = 0, s = 1;
|
||||
while (Math.Abs(t) >= Math.Pow(10,-6))
|
||||
{
|
||||
pi += t;
|
||||
n += 2;
|
||||
s = -s;
|
||||
t = s / n;
|
||||
}
|
||||
pi *= 4;
|
||||
Console.WriteLine("pi={0}" ,pi);
|
||||
}
|
||||
}
|
||||
}
|
||||
10
cs3/C_Sharp_3_5/C_Sharp_3_5.csproj
Normal file
10
cs3/C_Sharp_3_5/C_Sharp_3_5.csproj
Normal file
@@ -0,0 +1,10 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
||||
25
cs3/C_Sharp_3_5/C_Sharp_3_5.sln
Normal file
25
cs3/C_Sharp_3_5/C_Sharp_3_5.sln
Normal file
@@ -0,0 +1,25 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.14.36616.10 d17.14
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "C_Sharp_3_5", "C_Sharp_3_5.csproj", "{08A80C9F-F90A-4F5B-B120-F68F97FA072A}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{08A80C9F-F90A-4F5B-B120-F68F97FA072A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{08A80C9F-F90A-4F5B-B120-F68F97FA072A}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{08A80C9F-F90A-4F5B-B120-F68F97FA072A}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{08A80C9F-F90A-4F5B-B120-F68F97FA072A}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {92ACD8AD-BE2B-434E-9DF1-2A91A64FD90A}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
10
cs3/C_Sharp_3_5/Program.cs
Normal file
10
cs3/C_Sharp_3_5/Program.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
namespace C_Sharp_3_5
|
||||
{
|
||||
internal class Program
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
Console.WriteLine("Hello, World!");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user