double PP1[8][8];
double PP2[8][8];
double x;
double n;
double d;
for(double i = 0; i < 8; i++)
{
n = i + 1;
d = n / (n * (n - 1) - (n - 2) * (n - 3) / 2);
x = (n - 1) * d;
for(double k = 0; k < i ; k++)
{
PP1[i][k] = x - k * d;
}
PP1[i][i] = x;
}
有六个错误:
e:\documents and settings\administrator\my documents\map\main.cpp(77) : error C2108: subscript is not of integral type
e:\documents and settings\administrator\my documents\map\main.cpp(77) : error C2108: subscript is not of integral type
e:\documents and settings\administrator\my documents\map\main.cpp(77) : error C2440: '=' : cannot convert from 'double' to 'double (*)[8]'
There is no context in which this conversion is possible
e:\documents and settings\administrator\my documents\map\main.cpp(79) : error C2108: subscript is not of integral type
e:\documents and settings\administrator\my documents\map\main.cpp(79) : error C2108: subscript is not of integral type
e:\documents and settings\administrator\my documents\map\main.cpp(79) : error C2440: '=' : cannot convert from 'double' to 'double (*)[8]'
There is no context in which this conversion is possible
怎么回事啊?
double PP2[8][8];
double x;
double n;
double d;
for(double i = 0; i < 8; i++)
{
n = i + 1;
d = n / (n * (n - 1) - (n - 2) * (n - 3) / 2);
x = (n - 1) * d;
for(double k = 0; k < i ; k++)
{
PP1[i][k] = x - k * d;
}
PP1[i][i] = x;
}
有六个错误:
e:\documents and settings\administrator\my documents\map\main.cpp(77) : error C2108: subscript is not of integral type
e:\documents and settings\administrator\my documents\map\main.cpp(77) : error C2108: subscript is not of integral type
e:\documents and settings\administrator\my documents\map\main.cpp(77) : error C2440: '=' : cannot convert from 'double' to 'double (*)[8]'
There is no context in which this conversion is possible
e:\documents and settings\administrator\my documents\map\main.cpp(79) : error C2108: subscript is not of integral type
e:\documents and settings\administrator\my documents\map\main.cpp(79) : error C2108: subscript is not of integral type
e:\documents and settings\administrator\my documents\map\main.cpp(79) : error C2440: '=' : cannot convert from 'double' to 'double (*)[8]'
There is no context in which this conversion is possible
怎么回事啊?
解决方案 »
- 我的代码错在那里呢?delete出错
- StringFromCLSID 得到的 lpolestr需要释放吗?
- 如何最大化显示图片和全屏显示图片
- 我问一个简单的问题(关于构造函数的问题)
- 那里有Windows的源码下载?
- 明天去一搞银行外围系统及产品开发的公司面试,想问问需要具体什么知识和是在什
- 位图处理
- 怎样判断一个输入框是否是密码输入框?
- 为何调用GetClientRect()得出rect的结果不一样?
- 各位高手,不要以为是高手就不爱回答,不用CCheckList,用api如何实现CheckList
- 请教:谁有PPPoE实现的源码,或者告诉我到哪里去找?
- 有没有Win32 SDK的帮助文档啊,各位高手给个下载
subscript is not of integral type
A nonintegral expression was used in an array subscript
Compiler Error C2440
'conversion' : cannot convert from 'type1' to 'type2'The compiler was unable to cast from ‘type1’ to ‘type2.’ If you’ve encountered this error on code which compiled with an earlier version of Visual C++, please read Technote: Improved Conformance to ANSI C++ for more information.The following example illustrates this error.void main()
{
int *i;
float j;
j = (float)i; /* cannot cast from
pointer to int to float */
}