程序运行没有结果,请大家帮忙指点迷津
实在不明白为什么没结果,还请各位帮帮忙 指点一下#include "stdafx.h"
#include<iostream>
#include<set>
#include"compare.h"
#include<queue>
#include<cmath>
#define M 20
#define N 2
using namespace std;
int main()
{
int coordinate[20][2]={
{55,34},{22,44},{23,43},{24,25},{12,55},{66,32},{78,13},{90,56},{66,43},{23,45},
{33,78},{90,56},{34,56},{24,76},{23,88},{52,75},{65,43},{32,76},{73,46},{21,23}
};
int i,j,k,h,l,chance,turn,sum,g;
int flag[M]={};
int mark[M]={};
for(turn=0;turn<3;turn++)
{
sum=0;
cout<<endl;
for(h=0;h<M;h++)
{
chance=0;
if(flag[h]==0)
{
for(j=0;j<M;j++)
{
k=0;
for(i=0;i<N;i++)
{
if(flag[j]==0&&h!=j)
{
if(compare(coordinate[h][i],coordinate[j][i])==2)
k++;
}
else
break;
}
if(k==0)
chance++;
}
if(chance==0)
{
mark[sum]=h;
sum++;
for(l=0;l<N;l++)
{
cout<<coordinate[h][l]<<" ";
}
cout<<endl;
}
}
}
for(g=0;g<sum;g++)
{
flag[mark[g]]=1;
}
}
}
函数compare(int a,int b)的定义
int compare(int a,int b);
using namespace std;
int compare(int a,int b)
{
int x;
if(a>b)
x=2;
if(a=b)
x=1;
if(a<b)
x=0;
return(x);
}