1
排序步驟我已經寫了這個代碼爲C#我想在C#中的GUI
void SelectionSort()
{
clearFontColor();
int i, j, min, temp;
for (i = 0; i < 9; i++)
{
min = i;
for (j = i + 1; j < 10; j++)
{
if (input[min] > input[j])
{
min = j;
}
}
if (min != i)
{
temp = input[i];
input[i] = input[min];
input[min] = temp;
}
}
show(input);
}
但這是做只有一個步驟,稍後它stops.How來實現這一目標。
的排序操作按鈕就像
private void button2_Click(object sender, EventArgs e)
{
// lbl_step.Visible = true;
if (radioButton2.Checked)
{
InsertionSort();
}
else if (radioButton1.Checked)
{
bubble();
}
else if (radioButton3.Checked)
{
SelectionSort();
}
}
和它只是一個之後,它停止工作時間的工作。
這不是C.您不必在方法開始時聲明所有變量。 – 2012-02-11 01:08:05
你能解決這個問題嗎? – 2012-02-11 01:26:32
如果我正確讀取所有代碼,則您傳遞的數組是通過引用。因此,當您第一次對數組進行排序時。然後第二次數組已經排序。我錯過了什麼嗎?這是你問的問題嗎? – 2012-02-11 01:28:53