using System.IO;
//写文件
public void write()
{
try
{
string path = @"f:\t1.txt";
//创建并写入(将覆盖已有文件)
if (!File.Exists(path))
{
using (StreamWriter sw = File.CreateText(path))
{
for(int i=0; i<N; i++)
{
for(int j=0; j<N; j++)
sw.Write(G[i, j] + " ");
sw.WriteLine();
}
}
}
}
catch (Exception e)
{
Console.WriteLine("The process failed: {0}", e.ToString());
}
}
c#---写文件
最新推荐文章于 2021-10-19 16:25:55 发布