日期:2014-05-17 浏览次数:20873 次
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using KeyType = System.Int32;
namespace SeqSearchWeb
{
public unsafe struct SSTable //define structure SSTable
{
public KeyType* elem;
public int length;
};
public partial class SeqSearch : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
int[] elem = new int[100];
SSTable ST = new SSTable();
protected void Button1_Click(object sender, EventArgs e)
{
ST.length = Convert.ToInt32(TextBox3.Text);
Random ra=new Random(unchecked((int)DateTime.Now.Ticks));
for(int i=1;i<=ST.length;i++)
{
elem[i] = ra.Next(0, 99); //调用随机函数random()初始化成员 ST.elem
this.Label3.Text += Convert.ToString(elem[i]) + " ";
}
}
protected void TextBox1_TextChanged(object sender, EventArgs e)
{
}
unsafe private int Search_Seq(SSTable ST, KeyType key)
{
ST.length = Convert.ToInt32(TextBox3.Text);
try
{
&nb