添加项目文件。

This commit is contained in:
Kister Hakusan
2025-09-08 09:52:22 +08:00
parent 1313433a12
commit 3724bc0ad5
18 changed files with 481 additions and 0 deletions
+43
View File
@@ -0,0 +1,43 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.14.36202.13 d17.14
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "test1", "test1\test1.csproj", "{431A94A0-24B2-497E-A1FE-693FA2EF350F}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Lesson1注释&输入输出", "lesson1\Lesson1注释&输入输出.csproj", "{C9D85F7A-86E5-4034-AA0B-F469E441F9C5}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Lesson1练习题", "Lession1练习题\Lesson1练习题.csproj", "{D965940D-E758-4A7C-977A-74E5793C593B}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Lesson2变量", "Lesson2变量\Lesson2变量.csproj", "{21CE6A7D-CC82-4F41-A28F-54D2E535FB3F}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{431A94A0-24B2-497E-A1FE-693FA2EF350F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{431A94A0-24B2-497E-A1FE-693FA2EF350F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{431A94A0-24B2-497E-A1FE-693FA2EF350F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{431A94A0-24B2-497E-A1FE-693FA2EF350F}.Release|Any CPU.Build.0 = Release|Any CPU
{C9D85F7A-86E5-4034-AA0B-F469E441F9C5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C9D85F7A-86E5-4034-AA0B-F469E441F9C5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C9D85F7A-86E5-4034-AA0B-F469E441F9C5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C9D85F7A-86E5-4034-AA0B-F469E441F9C5}.Release|Any CPU.Build.0 = Release|Any CPU
{D965940D-E758-4A7C-977A-74E5793C593B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D965940D-E758-4A7C-977A-74E5793C593B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D965940D-E758-4A7C-977A-74E5793C593B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D965940D-E758-4A7C-977A-74E5793C593B}.Release|Any CPU.Build.0 = Release|Any CPU
{21CE6A7D-CC82-4F41-A28F-54D2E535FB3F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{21CE6A7D-CC82-4F41-A28F-54D2E535FB3F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{21CE6A7D-CC82-4F41-A28F-54D2E535FB3F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{21CE6A7D-CC82-4F41-A28F-54D2E535FB3F}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {972D1D6C-AC89-49B8-9AE0-EB671A0842D5}
EndGlobalSection
EndGlobal
@@ -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>
+17
View File
@@ -0,0 +1,17 @@
using System;
namespace
{
class program
{
static void Main(string[] args)
{
Console.WriteLine("*************");
for (int i = 0; i < 10; i++)
{
Console.WriteLine("* *");
}
Console.WriteLine("*************");
}
}
}
@@ -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>
+2
View File
@@ -0,0 +1,2 @@
// See https://aka.ms/new-console-template for more information
Console.WriteLine("Hello, World!");
@@ -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>
+40
View File
@@ -0,0 +1,40 @@
//双杠注释
using System;
namespace Lession1
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Hello world");
//writeline是输出后换行
Console.WriteLine("你好");
//wirte是输出后不换行
Console.Write("请输入一些东西:");
//这是输入一行东西,不按回车不算结束
Console.ReadLine();
Console.WriteLine("输入完成");
Console.Write("请输入一些东西:");
//检测用户是否按键,只要按了任意一个按键就算结束
Console.ReadKey();
Console.WriteLine("输入完成");
}
}
}
/*多杠注释
*
*
*/
///三杠注释
///</summary>
///类
///</summary>
//Console.WriteLine("你好!");
//Ctrl + K + U取消注释
//Ctrl + K + C注释快捷键
+13
View File
@@ -0,0 +1,13 @@
using System;
namespace
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("hello world");
}
}
}
+10
View 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>
+43
View File
@@ -0,0 +1,43 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.14.36202.13
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "test", "test\test.csproj", "{B02A4395-F066-4E9C-96EB-C3A8244711A8}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Lesson10_封装-运算符重载练习", "Lesson10_封装-运算符重载\Lesson10_封装-运算符重载练习.csproj", "{0AF1A6D3-2B1A-4F58-91A1-9E71CD4C7289}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Lesson10_封装-运算符重载", "Lesson10_封装-运算符重载联系\Lesson10_封装-运算符重载.csproj", "{DEE2177C-8552-488D-A36A-A47B8547580D}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Lesson11_内部类和分部类", "Lesson11_内部类和分部类\Lesson11_内部类和分部类.csproj", "{51A60C77-3609-42BD-B0D9-83E1B61B6E69}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{B02A4395-F066-4E9C-96EB-C3A8244711A8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B02A4395-F066-4E9C-96EB-C3A8244711A8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B02A4395-F066-4E9C-96EB-C3A8244711A8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B02A4395-F066-4E9C-96EB-C3A8244711A8}.Release|Any CPU.Build.0 = Release|Any CPU
{0AF1A6D3-2B1A-4F58-91A1-9E71CD4C7289}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0AF1A6D3-2B1A-4F58-91A1-9E71CD4C7289}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0AF1A6D3-2B1A-4F58-91A1-9E71CD4C7289}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0AF1A6D3-2B1A-4F58-91A1-9E71CD4C7289}.Release|Any CPU.Build.0 = Release|Any CPU
{DEE2177C-8552-488D-A36A-A47B8547580D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DEE2177C-8552-488D-A36A-A47B8547580D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DEE2177C-8552-488D-A36A-A47B8547580D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DEE2177C-8552-488D-A36A-A47B8547580D}.Release|Any CPU.Build.0 = Release|Any CPU
{51A60C77-3609-42BD-B0D9-83E1B61B6E69}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{51A60C77-3609-42BD-B0D9-83E1B61B6E69}.Debug|Any CPU.Build.0 = Debug|Any CPU
{51A60C77-3609-42BD-B0D9-83E1B61B6E69}.Release|Any CPU.ActiveCfg = Release|Any CPU
{51A60C77-3609-42BD-B0D9-83E1B61B6E69}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {9DF28788-E99D-4F28-8968-F7C213A855D1}
EndGlobalSection
EndGlobal
@@ -0,0 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<RootNamespace>Lesson10_封装_运算符重载</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>
@@ -0,0 +1,126 @@
using System.Numerics;
using System.Runtime.Intrinsics;
namespace Lesson10_封装_运算符重载
{
//class Vector
//{
// public int x;
// public int y;
// public Vector(int x,int y)
// {
// this.x = x;
// this.y = y;
// }
// public static bool operator ==(Vector a, Vector b)
// {
// if (a.x == b.x && a.y == b.y)
// {
// return true;
// }
// else
// {
// return false;
// }
// }
// public static bool operator !=(Vector a, Vector b)
// {
// if (a.x != b.x && a.y != b.y)
// {
// return true;
// }
// else
// {
// return false;
// }
// }
//}
struct Position
{
int x;
int y;
public Position(int x,int y)
{
this.x = x;
this.y = y;
}
public static bool operator ==(Position a, Position b)
{
if (a.x == b.x && a.y == b.y)
{
return true;
}
else
{
return false;
}
}
public static bool operator !=(Position a, Position b)
{
if (a.x != b.x && a.y != b.y)
{
return true;
}
else
{
return false;
}
}
}
class Vector3
{
public int x,y,z;
public Vector3()
{
x = 0;
y = 0;
z = 0;
}
public Vector3(int x,int y,int z)
{
this.x = x;
this.y = y;
this.z = z;
}
public static Vector3 operator +(Vector3 a,Vector3 b)
{
Vector3 vector = new Vector3();
vector.x = a.x + b.x;
vector.y = a.y + b.y;
vector.z = a.z + b.z;
return vector;
}
public static Vector3 operator -(Vector3 a, Vector3 b)//一步到位写法
{
return new Vector3(a.x-b.x,a.y-b.y,a.z-b.z);
}
public static Vector3 operator *(Vector3 a, int b)
{
Vector3 vector = new Vector3();
vector.x = a.x * b;
vector.y = a.y * b;
vector.z = a.z * b;
return vector;
}
}
internal class Program
{
static void Main(string[] args)
{
Console.WriteLine("Hello, World!");
Position p1 = new Position(1, 2);
Position p2 = new Position(1, 2);
Console.WriteLine(p1 == p2);
Console.WriteLine(p1 != p2);
Vector3 v1 = new Vector3(2,2,2);
Vector3 v2 = new Vector3(1,1,1);
Vector3 v3 = v1 + v2;
Vector3 v4 = v1 - v2;
Vector3 v5 = v1 * 2;
Console.WriteLine(v3.x);
Console.WriteLine(v4.x);
Console.WriteLine(v5.x);
}
}
}
@@ -0,0 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<RootNamespace>Lesson10_封装_运算符重载联系</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>
@@ -0,0 +1,103 @@
namespace Lesson10_封装_运算符重载联系
{
#region
//概念
//让自定义类和结构体
//能够使用运算符
//使用关键字
//operator
//特点
//1.一定是一个公共的静态方法
//2.返回值写在operator前
//3.逻辑处理自定义
//作用
//让自定义类和结构体对象可以进行运算
//注意
//1.条件运算符需要承兑实现
//2.一个符号可以多个重载
//3.不能使用ref和out
#endregion
#region
//public static 返回值类型 operator 运算符(参数列表){}
#endregion
#region
class Point
{
public int x;
public int y;
public static Point operator +(Point p1,Point p2)
{
Point p = new Point();
p.x = p1.x + p2.x;
p.y = p1.y + p2.y;
return p;
}
public static Point operator +(Point p1, int value)
{
Point p = new Point();
p.x = p1.x + value;
p.y = p1.y + value;
return p;
}
public static Point operator +(int value, Point p1)
{
Point p = new Point();
p.x = p1.x + value;
p.y = p1.y + value;
return p;
}
}
#endregion
#region
#region
//注意运算所需的参数数量
//算术运算符
//- * / % ++ --都可以
//逻辑运算符
//!可以
//位运算符
//| & ^ ~ >> << 可以
//条件运算符
//>= <= == < >需要成对出现(写了>的就要写<的)
//一般返回值都是bool也可以是其他值
#endregion
#region
//逻辑与&& 逻辑或||
//索引符[]
//强转运算符()
//特殊运算符
//点. 三目运算符 赋值号=
#endregion
#endregion
internal class Program
{
static void Main(string[] args)
{
Console.WriteLine("Hello, World!");
#region 使
Point p = new Point();
p.x = 1;
p.y = 1;
Console.WriteLine(p.x+" "+p.y);
Point p2 = new Point();
p2.x = 2;
p2.y = 2;
Console.WriteLine(p2.x + " " + p2.y);
Point p3 = p + p2;
Console.WriteLine(p3.x + " " + p3.y);
Point p4 = p3 + 2;
Point p5 = 3 + p4;
#endregion
}
}
}
@@ -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>
@@ -0,0 +1,10 @@
namespace Lesson11_内部类和分部类
{
internal class Program
{
static void Main(string[] args)
{
Console.WriteLine("Hello, World!");
}
}
}
+2
View File
@@ -0,0 +1,2 @@
// See https://aka.ms/new-console-template for more information
Console.WriteLine("Hello, World!");
+10
View 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>