예제 #1
0
        public void test_read_bad_data()
        {
            int[]        arr_input = new int[] { 0, 1, 2, 3, 4, 5, 6, 7 };
            Fenwick_Tree ft        = new Fenwick_Tree(arr_input);

            Assert.AreEqual(false, ft.read(3) == 9);
        }
예제 #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            int a;

            if (int.TryParse(textBox1.Text, out a))
            {
                if (a < 0 || a >= f.Count)
                {
                    MessageBox.Show("out of range");
                }
                else
                {
                    label3.Text = Convert.ToString(f.read(a));
                }
            }
            else
            {
                MessageBox.Show("Error!");
            }
        }