{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void 文件ToolStripMenuItem_Click(object sender, EventArgs e)
{ }
private void 打开ToolStripMenuItem_Click(object sender, EventArgs e)
{
StreamReader myStream = new StreamReader("distance.txt");
OpenFileDialog openFileDialog1 = new OpenFileDialog();//新建OpenFileDialog对象
//初始化OpenFileDialog对象的属性
openFileDialog1.InitialDirectory = "D:\\projects\\C-W算法\\C-W算法\\bin\\Debug\\distance.txt";
openFileDialog1.Filter = "text files(*.txt)|*.txt|All files(*.*)|*.*";
openFileDialog1.FilterIndex = 2;
openFileDialog1.RestoreDirectory = true;
//用户单击OK返回
if (openFileDialog1.ShowDialog() == DialogResult.OK)
{
//读取文件
string FileName = "D:\\projects\\C-W算法\\C-W算法\\bin\\Debug\\distance.txt";
if (File.Exists(FileName))
{
//读取指定的文本文件,并支持中文编码字符
StreamReader objReader = new StreamReader(FileName, System.Text.Encoding.GetEncoding("gb2312"));
string aa = objReader.ReadToEnd();
objReader.Close();//关闭流
MessageBox.Show(aa);
}
} myStream.Close(); } private void 保存ToolStripMenuItem_Click(object sender, EventArgs e)
{
} private void 另存为ToolStripMenuItem_Click(object sender, EventArgs e)
{
Stream myStream;
//新建另存为对话框
SaveFileDialog saveFileDialog1 = new SaveFileDialog();
saveFileDialog1.Filter = "text files(*.txt)|*.txt|All files(*.*)|*.*";
saveFileDialog1.FilterIndex = 2;
saveFileDialog1.RestoreDirectory = true;
if (saveFileDialog1.ShowDialog() == DialogResult.OK)
{
//指定保存文件的文件名
if ((myStream = saveFileDialog1.OpenFile()) != null)
{
myStream.Close();
}
}
}
private void Form1_Load(object sender, EventArgs e)
{ }
private void 计算ToolStripMenuItem_Click(object sender, EventArgs e)
{
static void Main(string[] args)
{
FileStream fs = File.OpenRead("distance.txt");
byte[] b = new byte[fs.Length];
int[,] data = new int[,] { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } };
while (fs.Read(b, 0, b.Length) > 0)
{
string strAll = System.Text.Encoding.Default.GetString(b);//读取文本所有字符
string[] distance = System.Text.RegularExpressions.Regex.Split(strAll, "\t");//分隔字符
int i = 0; int j = 0;
for (; j < 9; j++)
{
data[i, j] = int.Parse(distance[j + i * 10]);
if (j >= 9)
{
j = 0;
i++;
} } }
string getString = arrAll[index[i]].ToString();
}
}
}
int i=1;int j;int m=0; int S(int m ),d;
for(j=2;i<j&&j<10;j++)
{
S(i,j)=d(0,i)+d(0,j)-d(i,j);
i++;
S(m)=S(i,j);
m++;
}
public class BubbleSorter
{
public BubbleSorter()
{ }
public void Sort(ref int [] list)
{
int i,j,temp;
bool done=false;
j=1;
while((j<list.Length)&&(!done))
{
done=true;
for(i=0;i<list.Length-j;i++)
{
if(list[i]>list[i+1])
{
done=false;
temp=list[i];
list[i]=list[i+1];
list[i+1]=temp;
}
}
j++;
}
}
}
public class MainClassBubble
{
public static void MainBubble()
{
int[] iArrary=new S[m];
BubbleSorter sh=new BubbleSorter();
sh.Sort(ref iArrary);
for(int m=0;m<iArrary.Length;m++)
Console.Write("{0} ",iArrary[m]);
Console.WriteLine();
Console.WriteLine();
}
}
}
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void 文件ToolStripMenuItem_Click(object sender, EventArgs e)
{ }
private void 打开ToolStripMenuItem_Click(object sender, EventArgs e)
{
StreamReader myStream = new StreamReader("distance.txt");
OpenFileDialog openFileDialog1 = new OpenFileDialog();//新建OpenFileDialog对象
//初始化OpenFileDialog对象的属性
openFileDialog1.InitialDirectory = "D:\\projects\\C-W算法\\C-W算法\\bin\\Debug\\distance.txt";
openFileDialog1.Filter = "text files(*.txt)|*.txt|All files(*.*)|*.*";
openFileDialog1.FilterIndex = 2;
openFileDialog1.RestoreDirectory = true;
//用户单击OK返回
if (openFileDialog1.ShowDialog() == DialogResult.OK)
{
//读取文件
string FileName = "D:\\projects\\C-W算法\\C-W算法\\bin\\Debug\\distance.txt";
if (File.Exists(FileName))
{
//读取指定的文本文件,并支持中文编码字符
StreamReader objReader = new StreamReader(FileName, System.Text.Encoding.GetEncoding("gb2312"));
string aa = objReader.ReadToEnd();
objReader.Close();//关闭流
MessageBox.Show(aa);
}
} myStream.Close(); } private void 保存ToolStripMenuItem_Click(object sender, EventArgs e)
{
} private void 另存为ToolStripMenuItem_Click(object sender, EventArgs e)
{
Stream myStream;
//新建另存为对话框
SaveFileDialog saveFileDialog1 = new SaveFileDialog();
saveFileDialog1.Filter = "text files(*.txt)|*.txt|All files(*.*)|*.*";
saveFileDialog1.FilterIndex = 2;
saveFileDialog1.RestoreDirectory = true;
if (saveFileDialog1.ShowDialog() == DialogResult.OK)
{
//指定保存文件的文件名
if ((myStream = saveFileDialog1.OpenFile()) != null)
{
myStream.Close();
}
}
}
private void Form1_Load(object sender, EventArgs e)
{ }
private void 计算ToolStripMenuItem_Click(object sender, EventArgs e)
{
static void Main(string[] args)
{
FileStream fs = File.OpenRead("distance.txt");
byte[] b = new byte[fs.Length];
int[,] data = new int[,] { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } };
while (fs.Read(b, 0, b.Length) > 0)
{
string strAll = System.Text.Encoding.Default.GetString(b);//读取文本所有字符
string[] distance = System.Text.RegularExpressions.Regex.Split(strAll, "\t");//分隔字符
int i = 0; int j = 0;
for (; j < 9; j++)
{
data[i, j] = int.Parse(distance[j + i * 10]);
if (j >= 9)
{
j = 0;
i++;
} } }
string getString = arrAll[index[i]].ToString();
}
}
}
int i=1;int j;int m=0; int S(int m ),d;
for(j=2;i<j&&j<10;j++)
{
S(i,j)=d(0,i)+d(0,j)-d(i,j);
i++;
S(m)=S(i,j);
m++;
}
public class BubbleSorter
{
public BubbleSorter()
{ }
public void Sort(ref int [] list)
{
int i,j,temp;
bool done=false;
j=1;
while((j<list.Length)&&(!done))
{
done=true;
for(i=0;i<list.Length-j;i++)
{
if(list[i]>list[i+1])
{
done=false;
temp=list[i];
list[i]=list[i+1];
list[i+1]=temp;
}
}
j++;
}
}
}
public class MainClassBubble
{
public static void MainBubble()
{
int[] iArrary=new S[m];
BubbleSorter sh=new BubbleSorter();
sh.Sort(ref iArrary);
for(int m=0;m<iArrary.Length;m++)
Console.Write("{0} ",iArrary[m]);
Console.WriteLine();
Console.WriteLine();
}
}
}
for(j=2;i <j&&j <10;j++)
{
S(i,j)=d(0,i)+d(0,j)-d(i,j);
i++;
S(m)=S(i,j);
m++;
}
显示命名空间并不直接包含诸如字段或方法之类的成员。
此外系统还提示我应输入一个},可是我一个一个搜索,没发现缺少;系统还说应输入类型、命名空间定义活文件尾。这些就是系统显示存在的三个错误。希望高手给予帮助。谢谢
private void 计算ToolStripMenuItem_Click(object sender, EventArgs e)
{
static void Main(string[] args)
{
还有自己找复制代码也要认真点