Archived
1
0

统一归档20260319

This commit is contained in:
2026-03-19 19:39:01 +08:00
Unverified
parent 4e148364a9
commit 3ea0af246b
187 changed files with 5041 additions and 75005 deletions

3
CS/lab11/11_4/11_4.slnx Normal file
View File

@@ -0,0 +1,3 @@
<Solution>
<Project Path="11_4/11_4.csproj" />
</Solution>

View File

@@ -0,0 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net10.0</TargetFramework>
<RootNamespace>_11_4</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>

View File

@@ -0,0 +1,34 @@
namespace _11_4
{
internal class Program
{
static void Main(string[] args)
{
const string FILE_NAME = "output.txt";
using (StreamWriter sw = new StreamWriter(FILE_NAME))
{
sw.WriteLine("---------------------");
sw.WriteLine("文本文件读取写入示例");
sw.WriteLine("---------------------");
sw.WriteLine("写入整数、浮点数、bool值、字符、字符串、日期");
Console.WriteLine("请输入一个整数");
int i = int.Parse(Console.ReadLine());
sw.WriteLine(i);
Console.WriteLine("写入一个浮点数");
double j = double.Parse(Console.ReadLine());
sw.WriteLine(j);
Console.WriteLine("写入一个bool值");
bool k = bool.Parse(Console.ReadLine());
sw.WriteLine(k);
Console.WriteLine("写入一个字符");
char a = char.Parse(Console.ReadLine());
sw.WriteLine(k);
Console.WriteLine("写入字符串");
string b = Console.ReadLine();
sw.WriteLine(b);
Console.WriteLine("写入当前日期");
sw.WriteLine(DateTime.Now);
}
}
}
}