C++高手请进。程序出错

来源:百度知道 编辑:UC知道 时间:2024/05/25 12:56:43
D:/PKUCTutor_S/mingw/bin/../lib/gcc/mingw32/3.4.5/../../../../include/c++/3.4.5/bits/stl_iterator_base_types.h:132: error: ‘int' is not a class, struct, or union type
上面这句话什么意思。请高手指教。

源程序如下

#include<iostream>
#include<stdlib.h>
#include<string.h>
#include<cmath>
using namespace std;
const int blankcolour=4,Length=10,totalnum=(Length+5)*(Length+5);

struct board {
int
b[Length + 1][Length + 1];
};
board cur;
struct points{
int px,py;
float p;
}score[totalnum];
int mysort(const void *e1,const void *e2)
{
points *p1,*p2;
p1=(points *)e1;
p2=(points *)e2;
if(p2->p-p1->p>=0)
return 1;
return -1;
}
void count(int row,int column,int num)
{
float point=0.0;
int i,j,npiece=0;
bool extra=1;
for(i=row;i<=row+4;i++){
for(j=column;j<=column+4;j++){
i

我在visual studio 2008 上运行了上面的程序,发现没有错误,只有两个double向float转型的警告!所以你的程序应该没有问题,也许是编译器的问题。你程序的可读性太差,希望以后改进,多用点标准库里面的东西,名字不要期的带短,还有少出现一些数字……

#include<stdlib.h>
#include<string.h>
改成这样试试:
#include<cstdlib>
#include<cstring>

error: ‘int' is not a class, struct, or union type
错误就看这个啊, 你哪边的数据类型用错了,把int当成 struct了