编译错误:[Error] 'int' is not a class, struct, or union type
帮忙看一下这个代码为什么会给出这个编译错误:165 53 D:\Dev-Cpp\MinGW64\lib\gcc\x86_64-w64-mingw32\4.9.2\include\c++\bits\stl_iterator_base_types.h [Error] 'int' is not a class, struct, or union type
程序代码:
#include<iostream> #include<cstdio> #include<cstdlib> #include<cstring> #include<string> #include<cctype> #include<sstream> #include<cmath> #include<algorithm> #include<queue> #include<vector> #include<set> #include<map> #include<cassert> #include<functional> using namespace std; int n,f[210]; struct node1{ int x; int y; }point[210]; struct node2{ int p1; int p2; double length; }edge[40005]; double distance(int i0,int j0){ double ans; ans=sqrt((point[i0].x-point[j0].x)*(point[i0].x-point[j0].x)+(point[i0].y-point[j0].y)*(point[i0].y-point[j0].y)); return ans; } int find(int number){ if(f[number]==number) return number; return f[number]=find(f[number]); } void join(int n1,int n2){ if(find(n1)!=find(n2)){ f[n1]=f[n2]; } } bool cmp(node2 e1,node2 e2){ return e1.length<e2.length; } int main(void){ int i,j,k,cas=0; double ans; while(scanf("%d",&n)!=EOF && n){ k=1; for(i=1;i<=n;i++){ scanf("%d %d",&point[i].x,&point[i].y); for(j=1;j<i;j++){ edge[k].p1=i; edge[k].p2=j; edge[k].length=distance(i,j); } } getchar(); sort(edge+1,edge+k,cmp); for(i=1;i<=n;i++) f[i]=i; for(i=1;i<k;i++){ join(edge[i].p1,edge[i].p2); ans=edge[i].length; if(find[1]==find[2]) break; } cas++; printf("Scenario #%d\n",cas); printf("Frog Distance = %.3f\n\n",ans); } return 0; }