错误 1 无法将带 [] 的索引应用于“StrigDs.SeqList”类型的表达式 C:/Inetpub/wwwroot/StrigDs/StrigDs/Form5.cs 39 13 StrigDs
2008-07-25 19:11
274 查看
错误 1 无法将带 [] 的索引应用于“StrigDs.SeqList<T>”类型的表达式 C:/Inetpub/wwwroot/StrigDs/StrigDs/Form5.cs 39 13 StrigDs
Error :
sqList[0] = key; //此句错误????????????
Program:
public class SeqList<T>
{
public SeqList<T> sqList;
public SeqList<T> GetLength()
{
return sqList.GetLength();
}
public int BinarySearch(SeqList<T> sqList, int key)
{
sqList[0] = key; //存放要查找的记录
int mid = 0;
int flag = -1;// 标志
int low = 1; //设置初始区间的下限值
int high = Convert.ToInt32(sqList.GetLength()); // 设置初始区间的上限值
//记录没有查找完
while (low <= high)
{
//middle
mid = (low + high) / 2;
if (sqList[0] == sqList[mid])
{
flag = mid;// search successful ,then save record to flag 's
break;
}
else if (sqList[0] < sqList[mid])
{ // left binary area
high = mid - 1;
}
else
{ // right binary area
low = mid + 1;
}
}
if (flag > 0)
{
Console.WriteLine("search is successful");
return flag;
}
else
{
Console.WriteLine("search is failed ");
return -1;
}
}
}
Error :
sqList[0] = key; //此句错误????????????
Program:
public class SeqList<T>
{
public SeqList<T> sqList;
public SeqList<T> GetLength()
{
return sqList.GetLength();
}
public int BinarySearch(SeqList<T> sqList, int key)
{
sqList[0] = key; //存放要查找的记录
int mid = 0;
int flag = -1;// 标志
int low = 1; //设置初始区间的下限值
int high = Convert.ToInt32(sqList.GetLength()); // 设置初始区间的上限值
//记录没有查找完
while (low <= high)
{
//middle
mid = (low + high) / 2;
if (sqList[0] == sqList[mid])
{
flag = mid;// search successful ,then save record to flag 's
break;
}
else if (sqList[0] < sqList[mid])
{ // left binary area
high = mid - 1;
}
else
{ // right binary area
low = mid + 1;
}
}
if (flag > 0)
{
Console.WriteLine("search is successful");
return flag;
}
else
{
Console.WriteLine("search is failed ");
return -1;
}
}
}
相关文章推荐
- 错误:无法将带[]的索引应用于ConnectionStringsCollection类型的表达式
- linq无法将带 [] 的索引应用于“object”类型的表达式,
- 关于读word中table出现“无法将带 [] 的索引应用于“Interop.Word.Tables”错误的解决
- nmon 运行时错误 13 类型不匹配
- C#与excel互操作 C#与excel互操作的错误无法将类型为“Microsoft.Office.Interop.Excel.ApplicationClass”的 COM 对象强制 如果您使用的电脑
- 配置错误 在唯一密钥属性“fileExtension”设置为“.log”时,无法添加类型为“mimeMap”的重复集合项
- ORA-06550: 第 1 行, 第 7 列: \nPLS-00306: 调用 'xxxxxx' 时参数个数或类型错误\nORA-06550: 第 1 行, 第 7 列: \nPL/SQL: Sta
- 运算符||无法应用于bool和string类型的操作数
- 错误:的'unary*'实参类型无效(有'诠释')
- 错误:Error:(11, 16) 错误: 不兼容的类型: CrimeListFragment无法转换为Fragment
- Microsoft VBScript 运行时错误 错误 '800a000d' 类型不匹配: 'regEx.Replace'
- 无法将 lambda 表达式 转换为类型“System.Delegate”,因为它不是委托类型
- asp(非asp.net)程序访问access数据库,无法写入、修改,提示错误:当前记录集不支持更新。这可能是提供程序的限制,也可能是选定锁定类型的限制。
- XP不能执行aspx,IIS HTTP 500 内部服务器错误 服务器无法加载应用程序 '/LM/W3SVC''/LM/W3SVC' '找不到指定的元数据
- SQL2005无法连接到.\SQLEXPRESS,用户'sa'登录失败(错误18456)解决方法
- 致命错误 RC1015: 无法打开包含文件 'afxres.h'
- 错误代码: 1247 Reference 'startTime' not supported (forward reference in item list)
- 浏览页面提示500内部错误,,事件查看器中出现:服务器无法加载应用程序 '/LM/W3SVC/1/ROOT'。错误是 '没有注册类别'
- 无法将类型“ASP.login_aspx”转换为“System.Web.UI.WebControls.Login” 错误处理
- 几种sql统计函数,mysql索引类型及方法,IF表达式等