急,c++出现error C2440: '=='、error C2446: '!='等错误!

来源:百度知道 编辑:UC知道 时间:2024/09/21 08:26:28
e:\单纯形法.cpp(14) : error C2446: '==' : no conversion from 'const int' to 'float *'
Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast
e:\单纯形法.cpp(14) : error C2040: '==' : 'float [100]' differs in levels of indirection from 'const int'
e:\单纯形法.cpp(15) : error C2440: '=' : cannot convert from 'float [100][100]' to 'float'
There is no context in which this conversion is possible
e:\单纯形法.cpp(19) : error C2440: '=' : cannot convert from 'const int' to 'float [100]'
There are no conversions to array types, although there are conversions to references or pointers to arrays
e:\单纯形法.cpp(26) : error C2664: 'fabs' : cannot convert parameter 1 from 'float [100]' to 'double'
There is no context in which this conversion is possible

把代码贴出来吧

放弃了,一会儿二维数组,一会儿一维数组的,
还有不少语法错误~~~~~~~~~~~~

To liujq007:
我上班,哪有假啊,就过年7天乐

错得太多,给你改语法错误不解决问题。

例如 matrix 是2维数组,不能一会儿写 matrix[j],一会儿写matrix,它需要两个下标。如果同 1 比较,要写:
if ( (int) matrix[j][i] == 1 && ....)

晕,一塌糊涂,指针和数据间当然不能用运算符了

总之很多错误,源代码贴出来吧。。

偶晕, 希声和寡,放假了,你怎么也不悠着点啊~~~~~去度假吧。。

matrix是个二维的数组,matrix[j]本身是一个一维float型数组,也可以理解为一个float*的指针,所以你用maxtrix[j] == 1比较是相当错误的,指针怎么可能和常数比较呢?这就是C2446。
float x[100]是一个浮点型数组,它的指针是不能修改的,而它的元素应该是浮点数,可是你却x[j]=matrix,也就是将一个float**赋给一个float,这又是无法理解的。这就是C2440
另外,浮点数和整形数是不能直接比较的,如果要比较一个float是否为0,应该这样:((f < 0.000001) && (f > -0.000001))

关键在后面:no conversion from 'const int' to 'float *' 不能将常量int转换成float指针

cannot convert from 'float [100][100]' to 'float' 不能将二维数组float[100][100]转换成float变量

cannot convert parameter 1 from 'float [100]' to 'double' 不能将第一个参数从float[100]数组转换成double

你的数据类型