form1.cs

来自「数据结构中的对树的搜索的方法。算法简单但实用」· CS 代码 · 共 49 行

CS
49
字号
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using DataSortGUI;

namespace 搜索
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            MakeIntArray mia = new MakeIntArray();
            int n = Convert.ToInt32(numericUpDown1.Value);
            mia.Execute(n);
            textBox1.Text = mia.ResutOfString;
            int[] a = mia.ResultOfArray;
            int m = Convert.ToInt32(textBox2.Text);

            bool fouond = false;

            for (int i = 0; i < n; i++)
            {
                if (a[i] == m)
                {
                    label6.Text = "第"+ Convert.ToString(i+1)+"位";
                    fouond = true;

                    break;
                }

            }

            if (fouond == false)
            {
                label6.Text = "未找到" ;
            }
            
        }
    }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?