马上加入IBC程序猿 各种源码随意下,各种教程随便看! 注册 每日签到 加入编程讨论群

C#教程 ASP.NET教程 C#视频教程程序源码享受不尽 C#技术求助 ASP.NET技术求助

【源码下载】 社群合作 申请版主 程序开发 【远程协助】 每天乐一乐 每日签到 【承接外包项目】 面试-葵花宝典下载

官方一群:

官方二群:

C#窗口冒泡升序与降序排序

  [复制链接]
查看6974 | 回复5 | 2016-9-28 20:34:59 | 显示全部楼层 |阅读模式
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[str.Length];
            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[j] > a[j + 1]) {
                        temp = a[j];
                        a[j] = a[j + 1];
                        a[j] = temp;
                    }
                }
                textBox2.Text += a + " ";
            }
            
        }
        private void button2_Click(object sender, EventArgs e)
        {
            textBox2.Text = "";
            String[] str = textBox1.Text.Trim().Split(' ');
            int[] a = new int[str.Length];
            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[j] <a[j + 1])
                    {
                        temp = a[j+1];
                        a[j+1] = a[j ];
                        a[j] = temp;
                    }
                }
                textBox2.Text += a + " ";
            }
            
        }
    }
}

daponi | 2016-9-28 20:36:25 | 显示全部楼层
刚学C#,哪位大神来指导下 ???
daponi | 2016-9-28 20:46:56 | 显示全部楼层
大神都到哪去了???
daponi | 2016-9-28 22:51:14 | 显示全部楼层
嗯,已经自己做好了
ibcadmin | 2016-9-29 09:34:50 | 显示全部楼层
.................来晚一步
C#论坛 www.ibcibc.com IBC编程社区
C#
C#论坛
IBC编程社区
剑弑 | 2016-9-29 15:09:31 | 显示全部楼层
。。。。。。来晚了
您需要登录后才可以回帖 登录 | 立即注册

*滑块验证:
loading...
logo
验证成功
验证未通过
加载失败,请点击重试
本版积分规则