C#窗口冒泡升序与降序排序
C#小白用两个文本框1和2,文本框1输入整数,点击按钮1文本框2升序输入整数,点击按钮2文本框2降序输入整数。我这样写是哪错了??using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace MaoPaoPaiXu
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void label1_Click(object sender, EventArgs e)
{
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void button1_Click(object sender, EventArgs e)
{
textBox2.Text = "";
String[] str = textBox1.Text.Trim().Split(' ');
int[] a = new int;
int temp;
for (int i = 0; i < str.Length; i++)
{
a = int.Parse(str);
}
for (int i = 0; i < a.Length; i++) {
for (int j = 0; j < a.Length; j++) {
if (a > a) {
temp = a;
a = a;
a = temp;
}
}
textBox2.Text += a + " ";
}
}
private void button2_Click(object sender, EventArgs e)
{
textBox2.Text = "";
String[] str = textBox1.Text.Trim().Split(' ');
int[] a = new int;
int temp;
for (int i = 0; i < str.Length; i++)
{
a = int.Parse(str);
}
for (int i = 0; i < a.Length; i++)
{
for (int j = 0; j < a.Length; j++)
{
if (a <a)
{
temp = a;
a = a;
a = temp;
}
}
textBox2.Text += a + " ";
}
}
}
}
刚学C#,哪位大神来指导下 ??? 大神都到哪去了??? 嗯,已经自己做好了 .................来晚一步 。。。。。。来晚了
页:
[1]