weixin_37533795 2017-02-15 15:54 采纳率: 12.5%
浏览 1891
已结题

C# asp.net 学生管理系统

namespace xsgl
{
public partial class _Default : System.Web.UI.Page
{

    protected void Page_Load(object sender, EventArgs e)
    {

    }

    protected void Button1_Click(object sender, EventArgs e)
    {
        //存放姓名和成绩人数
        string [] name = new string[3];
        float [] cj;
        int num = 3;
        string name1 = TextBox1.Text;
        string[] name2 = System.Text.RegularExpressions.Regex.Split(name1, @"[ ]+");

        for (int i = 0; i < num; i++)
        {
            name[i] = name2[i];

        }
        string cj1 = TextBox3.Text;
        string[] cj2 = System.Text.RegularExpressions.Regex.Split(cj1, @"[ ]+");
        cj = new float [num];
        for (int i = 0; i < num; i++)
        {
            cj[i] = float.Parse(cj2[i]);

        }
        //排序
        for (int i = 0; i < num; i++)
        {
            int j;
            for (j = 0; j < num - 1 - i; j++)
            {
                if (cj[j] > cj[j + 1])
                {
                    float temp = cj[j];
                    cj[j] = cj[j + 1];
                    cj[j + 1] = temp;

                     float Max = cj[j];

        Label1.Text = Max.ToString();

                }
            }

        }


    }
}

}
麻烦大神帮我看一下,编译不报错,开始添加查询就报错,说是数组长度超限什么的

  • 写回答

2条回答 默认 最新

  • threenewbee 2017-02-15 15:58
    关注

    string[] name2 = System.Text.RegularExpressions.Regex.Split(name1, @"[ ]+");
    这个分割出来不一定正好有4个元素

    评论

报告相同问题?

悬赏问题

  • ¥100 关于使用MATLAB中copularnd函数的问题
  • ¥20 在虚拟机的pycharm上
  • ¥15 jupyterthemes 设置完毕后没有效果
  • ¥15 matlab图像高斯低通滤波
  • ¥15 针对曲面部件的制孔路径规划,大家有什么思路吗
  • ¥15 钢筋实图交点识别,机器视觉代码
  • ¥15 如何在Linux系统中,但是在window系统上idea里面可以正常运行?(相关搜索:jar包)
  • ¥50 400g qsfp 光模块iphy方案
  • ¥15 两块ADC0804用proteus仿真时,出现异常
  • ¥15 关于风控系统,如何去选择