在数组问题内部进行顺序搜索

时间:2015-10-22 06:27:32

标签: c# arrays sequential

    string[] names = { "Abby", "Bill", "Connie", "David", "Eddy" };

    private void clearButton_Click(object sender, EventArgs e)
    {
        //Clear the array labels

        array1Label.Text = "";
        array2Label.Text = "";
    }

    private void passArrayButton_Click(object sender, EventArgs e)
    {
        //Demo how to pass an array
        //Which really means passing the reference vairable to the array.

        //Create an array

        int[] array1 = {10, 20, 30, 40, 50};

        //Pass array1 to a method to double and dsiplay the array

        DoubleArray(array1);

    }

    private void DoubleArray(int[] theArray1)
    {
        string output = "";
        for (int x = 0; x < theArray1.Length; x++)
        {
            theArray1[x] = theArray1[x] * 2;
        }

        //display the array

        foreach(int element in theArray1)
        {
            output = output + element + "\n";
        }

        array1Label.Text = output;

    }

    private void showNameButton_Click(object sender, EventArgs e)
    {         
        string[] names = { "Abby", "Bill", "Connie", "David", "Eddy" };           
    }     
}

对如何使用顺序搜索能够将“David”输出到标签上深感困惑,请帮忙。这是我的整个程序,第一部分只是乘以所有数字。请帮忙!没有外部输入只需要通过“名称”数组并选择“大卫”并将文本输出到标签中。

1 个答案:

答案 0 :(得分:0)

:)

hive> select name,price,notes from (select *, min(price)over(partition by name) as min_price from products) as a
    > where a.price = a.min_price;

将任何东西放在searchkey中以寻找除David以外的东西。