Skip to content

Commit c271dbf

Browse files
committed
General bug fix
1 parent b0448b9 commit c271dbf

File tree

17 files changed

+77
-58
lines changed

17 files changed

+77
-58
lines changed

1 Fundamental/1.1/1.1.32/Form1.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ private void button1_Click(object sender, EventArgs e)
2929
//选择文件
3030
openfiledialog.OpenFile();
3131
//修改路径框显示
32-
InputFilePath.Text = openfiledialog.FileName;
32+
this.InputFilePath.Text = openfiledialog.FileName;
3333
}
3434
catch (Exception ex)
3535
{
@@ -43,7 +43,7 @@ private void button2_Click(object sender, EventArgs e)
4343
try
4444
{
4545
//打开文件并读取全部数字
46-
string[] stringNums = File.ReadAllLines(InputFilePath.Text);
46+
string[] stringNums = File.ReadAllLines(this.InputFilePath.Text);
4747
//建立 double 数组
4848
double[] Numbers = new double[stringNums.Length];
4949
//将数字从 string 转换为 double
@@ -54,23 +54,23 @@ private void button2_Click(object sender, EventArgs e)
5454

5555
try
5656
{
57-
int N = int.Parse(InputN.Text);
57+
int N = int.Parse(this.InputN.Text);
5858
if (N <= 0)
5959
{
60-
ErrorLabel.Text = "N 必须大于 0";
60+
this.ErrorLabel.Text = "N 必须大于 0";
6161
return;
6262
}
63-
double L = double.Parse(InputL.Text);
64-
double R = double.Parse(InputR.Text);
63+
double L = double.Parse(this.InputL.Text);
64+
double R = double.Parse(this.InputR.Text);
6565
Program.StartDrawing(Numbers, N, L, R);
6666
}
6767
catch (FormatException fex)
6868
{
69-
ErrorLabel.Text = "格式有误(是否漏填了某项?)" + fex.Message;
69+
this.ErrorLabel.Text = "格式有误(是否漏填了某项?)" + fex.Message;
7070
}
7171
catch (OverflowException oex)
7272
{
73-
ErrorLabel.Text = "数据过大(输入的内容太多)" + oex.Message;
73+
this.ErrorLabel.Text = "数据过大(输入的内容太多)" + oex.Message;
7474
}
7575
}
7676
catch (Exception ex)

2 Sorting/2.1/2.1.10/Program.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ class Program
1010
{
1111
static void Main(string[] args)
1212
{
13-
// 因为对于部分有序的数组,插入排序比选择排序快
14-
// 这个结论可以在中文版 P158, 英文版 P252 找到
13+
// 因为对于部分有序的数组,插入排序比选择排序快
14+
// 这个结论可以在中文版 P158, 英文版 P252 找到
1515
}
1616
}
1717
}

2 Sorting/2.1/2.1.16/Program.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@ static void Main(string[] args)
2323
Console.WriteLine(CheckSelectionSort(test));
2424
}
2525

26+
/// <summary>
27+
/// 测试 Array.Sort() 方法。
28+
/// </summary>
29+
/// <param name="a">用于测试的数组。</param>
30+
/// <returns>如果数组对象没有改变,返回 true,否则返回 false。</returns>
2631
static bool CheckArraySort(string[] a)
2732
{
2833
string[] backup = new string[a.Length];
@@ -50,6 +55,11 @@ static bool CheckArraySort(string[] a)
5055
return true;
5156
}
5257

58+
/// <summary>
59+
/// 测试选择排序。
60+
/// </summary>
61+
/// <param name="a">用于测试的数组。</param>
62+
/// <returns>如果数组对象没有改变,返回 true,否则返回 false。</returns>
5363
static bool CheckSelectionSort(string[] a)
5464
{
5565
string[] backup = new string[a.Length];
@@ -77,6 +87,10 @@ static bool CheckSelectionSort(string[] a)
7787
return true;
7888
}
7989

90+
/// <summary>
91+
/// 选择排序,其中的交换部分使用新建对象并复制的方法。
92+
/// </summary>
93+
/// <param name="s">用于排序的数组。</param>
8094
public static void SelectionSort(string[] s)
8195
{
8296
for (int i = 0; i < s.Length; i++)

2 Sorting/2.1/2.1.17/Form2.Designer.cs

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

2 Sorting/2.1/2.1.17/Form2.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,14 @@ public Form2(int N)
2222
this.timer1.Interval = 60;
2323
this.timer1.Start();
2424

25-
Thread thread = new Thread(new ThreadStart(SelectionSort));
25+
Thread thread = new Thread(new ThreadStart(this.SelectionSort));
2626
thread.IsBackground = true;
2727
thread.Start();
2828
}
2929

30+
/// <summary>
31+
/// 选择排序。
32+
/// </summary>
3033
private void SelectionSort()
3134
{
3235
for (int i = 0; i < this.randomDoubles.Length; i++)
@@ -46,6 +49,9 @@ private void SelectionSort()
4649
}
4750
}
4851

52+
/// <summary>
53+
/// 在屏幕上用柱形图绘制数组。
54+
/// </summary>
4955
private void drawPanel()
5056
{
5157
Graphics graphics = this.CreateGraphics();

2 Sorting/2.1/2.1.17/Form3.Designer.cs

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

2 Sorting/2.1/2.1.17/Form3.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,14 @@ public Form3(int N)
2222
this.timer1.Interval = 60;
2323
this.timer1.Start();
2424

25-
Thread thread = new Thread(new ThreadStart(InsertionSort));
25+
Thread thread = new Thread(new ThreadStart(this.InsertionSort));
2626
thread.IsBackground = true;
2727
thread.Start();
2828
}
2929

30+
/// <summary>
31+
/// 插入排序。
32+
/// </summary>
3033
private void InsertionSort()
3134
{
3235
for (int i = 0; i < this.randomDoubles.Length; i++)
@@ -41,6 +44,9 @@ private void InsertionSort()
4144
}
4245
}
4346

47+
/// <summary>
48+
/// 在屏幕上用柱形图绘制数组。
49+
/// </summary>
4450
private void drawPanel()
4551
{
4652
Graphics graphics = this.CreateGraphics();

2 Sorting/2.1/2.1.18/Form2.Designer.cs

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

2 Sorting/2.1/2.1.18/Form2.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ public Form2(int N)
2222
}
2323
}
2424

25+
/// <summary>
26+
/// 选择排序。
27+
/// </summary>
2528
private void SelectionSort()
2629
{
2730
for (this.sortI = 0; this.sortI < this.randomDoubles.Length; this.sortI++)
@@ -42,6 +45,9 @@ private void SelectionSort()
4245
}
4346
}
4447

48+
/// <summary>
49+
/// 绘制柱形图。
50+
/// </summary>
4551
private void drawPanel()
4652
{
4753
Graphics graphics = this.CreateGraphics();

2 Sorting/2.1/2.1.18/Form3.Designer.cs

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)