Skip to content

Commit eeba6c5

Browse files
author
cuishuning
committed
Add week04
1 parent 07eba14 commit eeba6c5

File tree

17 files changed

+589
-0
lines changed

17 files changed

+589
-0
lines changed

CSharpiCourse.sln

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,16 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Week03", "Week03", "{E0A138
2323
EndProject
2424
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Homework03", "week03\Homework03\Homework03.csproj", "{73449A5B-C0BA-4B16-BAB9-21968E65FFFE}"
2525
EndProject
26+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Week04", "Week04", "{84D6D08D-B8AE-48F4-B8BB-73ECDCC76FE0}"
27+
EndProject
28+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Example01", "week04\Example01\Example01.csproj", "{7162D6E8-D13B-4EB5-B47B-59A7150AE909}"
29+
EndProject
30+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Example02", "week04\Example02\Example02.csproj", "{36B19DF8-12C9-4393-AA3E-E87C2C9E8E77}"
31+
EndProject
32+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Example03", "week04\Example03\Example03.csproj", "{92626274-F9FE-41C6-9CD3-2D632E32B9EC}"
33+
EndProject
34+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Homework04", "week04\Homework04\Homework04.csproj", "{A6E697C8-FE5A-4970-A936-835E7FB8E204}"
35+
EndProject
2636
Global
2737
GlobalSection(SolutionConfigurationPlatforms) = preSolution
2838
Debug|Any CPU = Debug|Any CPU
@@ -57,6 +67,22 @@ Global
5767
{73449A5B-C0BA-4B16-BAB9-21968E65FFFE}.Debug|Any CPU.Build.0 = Debug|Any CPU
5868
{73449A5B-C0BA-4B16-BAB9-21968E65FFFE}.Release|Any CPU.ActiveCfg = Release|Any CPU
5969
{73449A5B-C0BA-4B16-BAB9-21968E65FFFE}.Release|Any CPU.Build.0 = Release|Any CPU
70+
{7162D6E8-D13B-4EB5-B47B-59A7150AE909}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
71+
{7162D6E8-D13B-4EB5-B47B-59A7150AE909}.Debug|Any CPU.Build.0 = Debug|Any CPU
72+
{7162D6E8-D13B-4EB5-B47B-59A7150AE909}.Release|Any CPU.ActiveCfg = Release|Any CPU
73+
{7162D6E8-D13B-4EB5-B47B-59A7150AE909}.Release|Any CPU.Build.0 = Release|Any CPU
74+
{36B19DF8-12C9-4393-AA3E-E87C2C9E8E77}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
75+
{36B19DF8-12C9-4393-AA3E-E87C2C9E8E77}.Debug|Any CPU.Build.0 = Debug|Any CPU
76+
{36B19DF8-12C9-4393-AA3E-E87C2C9E8E77}.Release|Any CPU.ActiveCfg = Release|Any CPU
77+
{36B19DF8-12C9-4393-AA3E-E87C2C9E8E77}.Release|Any CPU.Build.0 = Release|Any CPU
78+
{92626274-F9FE-41C6-9CD3-2D632E32B9EC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
79+
{92626274-F9FE-41C6-9CD3-2D632E32B9EC}.Debug|Any CPU.Build.0 = Debug|Any CPU
80+
{92626274-F9FE-41C6-9CD3-2D632E32B9EC}.Release|Any CPU.ActiveCfg = Release|Any CPU
81+
{92626274-F9FE-41C6-9CD3-2D632E32B9EC}.Release|Any CPU.Build.0 = Release|Any CPU
82+
{A6E697C8-FE5A-4970-A936-835E7FB8E204}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
83+
{A6E697C8-FE5A-4970-A936-835E7FB8E204}.Debug|Any CPU.Build.0 = Debug|Any CPU
84+
{A6E697C8-FE5A-4970-A936-835E7FB8E204}.Release|Any CPU.ActiveCfg = Release|Any CPU
85+
{A6E697C8-FE5A-4970-A936-835E7FB8E204}.Release|Any CPU.Build.0 = Release|Any CPU
6086
EndGlobalSection
6187
GlobalSection(SolutionProperties) = preSolution
6288
HideSolutionNode = FALSE
@@ -69,6 +95,10 @@ Global
6995
{2326F397-7581-451C-BA6D-AB8461996A12} = {5E4192D2-12C7-420E-916B-AFA6234473A9}
7096
{7AE08E67-D151-462F-B175-EAEE00CFA4F5} = {E0A138CD-699C-4281-8F91-C22665D07DF6}
7197
{73449A5B-C0BA-4B16-BAB9-21968E65FFFE} = {E0A138CD-699C-4281-8F91-C22665D07DF6}
98+
{7162D6E8-D13B-4EB5-B47B-59A7150AE909} = {84D6D08D-B8AE-48F4-B8BB-73ECDCC76FE0}
99+
{36B19DF8-12C9-4393-AA3E-E87C2C9E8E77} = {84D6D08D-B8AE-48F4-B8BB-73ECDCC76FE0}
100+
{92626274-F9FE-41C6-9CD3-2D632E32B9EC} = {84D6D08D-B8AE-48F4-B8BB-73ECDCC76FE0}
101+
{A6E697C8-FE5A-4970-A936-835E7FB8E204} = {84D6D08D-B8AE-48F4-B8BB-73ECDCC76FE0}
72102
EndGlobalSection
73103
GlobalSection(ExtensibilityGlobals) = postSolution
74104
SolutionGuid = {A415464C-1CBF-4447-B90A-7EA90D09A66F}

week04/Example01/App.config

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<configuration>
3+
<startup>
4+
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
5+
</startup>
6+
</configuration>

week04/Example01/Example01.csproj

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
4+
<PropertyGroup>
5+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
6+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
7+
<ProjectGuid>{7162D6E8-D13B-4EB5-B47B-59A7150AE909}</ProjectGuid>
8+
<OutputType>Exe</OutputType>
9+
<RootNamespace>Example01</RootNamespace>
10+
<AssemblyName>Example01</AssemblyName>
11+
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
12+
<FileAlignment>512</FileAlignment>
13+
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
14+
<Deterministic>true</Deterministic>
15+
</PropertyGroup>
16+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
17+
<PlatformTarget>AnyCPU</PlatformTarget>
18+
<DebugSymbols>true</DebugSymbols>
19+
<DebugType>full</DebugType>
20+
<Optimize>false</Optimize>
21+
<OutputPath>bin\Debug\</OutputPath>
22+
<DefineConstants>DEBUG;TRACE</DefineConstants>
23+
<ErrorReport>prompt</ErrorReport>
24+
<WarningLevel>4</WarningLevel>
25+
</PropertyGroup>
26+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
27+
<PlatformTarget>AnyCPU</PlatformTarget>
28+
<DebugType>pdbonly</DebugType>
29+
<Optimize>true</Optimize>
30+
<OutputPath>bin\Release\</OutputPath>
31+
<DefineConstants>TRACE</DefineConstants>
32+
<ErrorReport>prompt</ErrorReport>
33+
<WarningLevel>4</WarningLevel>
34+
</PropertyGroup>
35+
<ItemGroup>
36+
<Reference Include="System" />
37+
<Reference Include="System.Core" />
38+
<Reference Include="System.Xml.Linq" />
39+
<Reference Include="System.Data.DataSetExtensions" />
40+
<Reference Include="Microsoft.CSharp" />
41+
<Reference Include="System.Data" />
42+
<Reference Include="System.Net.Http" />
43+
<Reference Include="System.Xml" />
44+
</ItemGroup>
45+
<ItemGroup>
46+
<Compile Include="Program.cs" />
47+
<Compile Include="Properties\AssemblyInfo.cs" />
48+
</ItemGroup>
49+
<ItemGroup>
50+
<None Include="App.config" />
51+
</ItemGroup>
52+
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
53+
</Project>

week04/Example01/Program.cs

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
///<summary>
2+
///说明:代码可以在GitHub下载
3+
///下载地址:https://github.com/AndrewChui/CSharpiCourse
4+
///作者:Cui Shuning
5+
///提示:请使用https访问Github,系统在上传时,自动删除了s!!
6+
///</summary>
7+
8+
using System;
9+
10+
11+
namespace Example01
12+
{
13+
class Program
14+
{
15+
static void Main(string[] args)
16+
{
17+
//判断三角形的三边
18+
var s = Console.ReadLine().Split(' ');
19+
var a = Convert.ToDouble(s[0]);
20+
var b = Convert.ToDouble(s[1]);
21+
var c = Convert.ToDouble(s[2]);
22+
if(a+b>c && b+c>a && a+c>b)
23+
{
24+
Console.WriteLine("YES");
25+
}
26+
else
27+
{
28+
Console.WriteLine("NO");
29+
}
30+
31+
}
32+
}
33+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
using System.Reflection;
2+
using System.Runtime.CompilerServices;
3+
using System.Runtime.InteropServices;
4+
5+
// General Information about an assembly is controlled through the following
6+
// set of attributes. Change these attribute values to modify the information
7+
// associated with an assembly.
8+
[assembly: AssemblyTitle("Example01")]
9+
[assembly: AssemblyDescription("")]
10+
[assembly: AssemblyConfiguration("")]
11+
[assembly: AssemblyCompany("")]
12+
[assembly: AssemblyProduct("Example01")]
13+
[assembly: AssemblyCopyright("Copyright © 2019")]
14+
[assembly: AssemblyTrademark("")]
15+
[assembly: AssemblyCulture("")]
16+
17+
// Setting ComVisible to false makes the types in this assembly not visible
18+
// to COM components. If you need to access a type in this assembly from
19+
// COM, set the ComVisible attribute to true on that type.
20+
[assembly: ComVisible(false)]
21+
22+
// The following GUID is for the ID of the typelib if this project is exposed to COM
23+
[assembly: Guid("7162d6e8-d13b-4eb5-b47b-59a7150ae909")]
24+
25+
// Version information for an assembly consists of the following four values:
26+
//
27+
// Major Version
28+
// Minor Version
29+
// Build Number
30+
// Revision
31+
//
32+
// You can specify all the values or you can default the Build and Revision Numbers
33+
// by using the '*' as shown below:
34+
// [assembly: AssemblyVersion("1.0.*")]
35+
[assembly: AssemblyVersion("1.0.0.0")]
36+
[assembly: AssemblyFileVersion("1.0.0.0")]

week04/Example02/App.config

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<configuration>
3+
<startup>
4+
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
5+
</startup>
6+
</configuration>

week04/Example02/Example02.csproj

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
4+
<PropertyGroup>
5+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
6+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
7+
<ProjectGuid>{36B19DF8-12C9-4393-AA3E-E87C2C9E8E77}</ProjectGuid>
8+
<OutputType>Exe</OutputType>
9+
<RootNamespace>Example02</RootNamespace>
10+
<AssemblyName>Example02</AssemblyName>
11+
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
12+
<FileAlignment>512</FileAlignment>
13+
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
14+
<Deterministic>true</Deterministic>
15+
</PropertyGroup>
16+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
17+
<PlatformTarget>AnyCPU</PlatformTarget>
18+
<DebugSymbols>true</DebugSymbols>
19+
<DebugType>full</DebugType>
20+
<Optimize>false</Optimize>
21+
<OutputPath>bin\Debug\</OutputPath>
22+
<DefineConstants>DEBUG;TRACE</DefineConstants>
23+
<ErrorReport>prompt</ErrorReport>
24+
<WarningLevel>4</WarningLevel>
25+
</PropertyGroup>
26+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
27+
<PlatformTarget>AnyCPU</PlatformTarget>
28+
<DebugType>pdbonly</DebugType>
29+
<Optimize>true</Optimize>
30+
<OutputPath>bin\Release\</OutputPath>
31+
<DefineConstants>TRACE</DefineConstants>
32+
<ErrorReport>prompt</ErrorReport>
33+
<WarningLevel>4</WarningLevel>
34+
</PropertyGroup>
35+
<ItemGroup>
36+
<Reference Include="System" />
37+
<Reference Include="System.Core" />
38+
<Reference Include="System.Xml.Linq" />
39+
<Reference Include="System.Data.DataSetExtensions" />
40+
<Reference Include="Microsoft.CSharp" />
41+
<Reference Include="System.Data" />
42+
<Reference Include="System.Net.Http" />
43+
<Reference Include="System.Xml" />
44+
</ItemGroup>
45+
<ItemGroup>
46+
<Compile Include="Program.cs" />
47+
<Compile Include="Properties\AssemblyInfo.cs" />
48+
</ItemGroup>
49+
<ItemGroup>
50+
<None Include="App.config" />
51+
</ItemGroup>
52+
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
53+
</Project>

week04/Example02/Program.cs

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
///<summary>
2+
///说明:代码可以在GitHub下载
3+
///下载地址:https://github.com/AndrewChui/CSharpiCourse
4+
///作者:Cui Shuning
5+
///提示:请使用https访问Github,系统在上传时,自动删除了s!!
6+
///</summary>
7+
8+
using System;
9+
10+
namespace Example02
11+
{
12+
class Program
13+
{
14+
//a+aa+aaa....
15+
static void Main(string[] args)
16+
{
17+
var a = Convert.ToInt32(Console.ReadLine());
18+
const int N = 7;
19+
var sum = 0;
20+
var aNext = a;
21+
int n = 0;
22+
while(n<N)
23+
{
24+
sum += aNext;
25+
aNext = aNext * 10 + a;
26+
n++;
27+
}
28+
Console.WriteLine("While: Sum={0}", sum);
29+
30+
sum = n = 0;
31+
aNext = a;
32+
do
33+
{
34+
sum += aNext;
35+
aNext = aNext * 10 + a;
36+
n++;
37+
} while (n < N);
38+
Console.WriteLine("Do-While: Sum={0}", sum);
39+
40+
sum = n = 0;
41+
aNext = a;
42+
for(int i=0;i<N;i++)
43+
{
44+
sum += aNext;
45+
aNext = aNext * 10 + a;
46+
}
47+
Console.WriteLine("For: Sum={0}", sum);
48+
}
49+
}
50+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
using System.Reflection;
2+
using System.Runtime.CompilerServices;
3+
using System.Runtime.InteropServices;
4+
5+
// General Information about an assembly is controlled through the following
6+
// set of attributes. Change these attribute values to modify the information
7+
// associated with an assembly.
8+
[assembly: AssemblyTitle("Example02")]
9+
[assembly: AssemblyDescription("")]
10+
[assembly: AssemblyConfiguration("")]
11+
[assembly: AssemblyCompany("")]
12+
[assembly: AssemblyProduct("Example02")]
13+
[assembly: AssemblyCopyright("Copyright © 2019")]
14+
[assembly: AssemblyTrademark("")]
15+
[assembly: AssemblyCulture("")]
16+
17+
// Setting ComVisible to false makes the types in this assembly not visible
18+
// to COM components. If you need to access a type in this assembly from
19+
// COM, set the ComVisible attribute to true on that type.
20+
[assembly: ComVisible(false)]
21+
22+
// The following GUID is for the ID of the typelib if this project is exposed to COM
23+
[assembly: Guid("36b19df8-12c9-4393-aa3e-e87c2c9e8e77")]
24+
25+
// Version information for an assembly consists of the following four values:
26+
//
27+
// Major Version
28+
// Minor Version
29+
// Build Number
30+
// Revision
31+
//
32+
// You can specify all the values or you can default the Build and Revision Numbers
33+
// by using the '*' as shown below:
34+
// [assembly: AssemblyVersion("1.0.*")]
35+
[assembly: AssemblyVersion("1.0.0.0")]
36+
[assembly: AssemblyFileVersion("1.0.0.0")]

week04/Example03/App.config

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<configuration>
3+
<startup>
4+
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
5+
</startup>
6+
</configuration>

0 commit comments

Comments
 (0)