使用Code Blocks 编译并运行出错 什么原因

ytu_ls ytu_ls 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
#include <iostream>
#include <algorithm>
#include <stdio.h>
using namespace std;
struct Point{double x,y;};
Point p[2000];
bool cmp(Point a,Point b)
{
if(a.y==b.y)
{
return a.x<b.x;
}
else return a.y>b.y;

}
bool cmp1(Point a,Point b)
{
return a.x>b.x;
}
void sort_t(Point p[],int len)
{
int yTo[2000][2];
int s,e;
double temp;
int count=0;
sort(p,p+len,cmp);
temp=p[0].y;
s=0;
yTo[count][0]=s;
for(int i=1;i<len;i++)
{
if(temp==p[i].y)
{
e=i;
yTo[count][1]=e;
}
else
{
s=i;
yTo[count++][0]=s;
temp=p[i].y;
}
}
for(int i=0;i<count;i++)
{
int j=yTo[i][0];
if(i%2==0)
{
sort(p+j,p+yTo[i][1],cmp);
}
else
{
sort(p+j,p+yTo[i][1],cmp1);
}
}
}
int main()
{
freopen("f:/in.txt","r",stdin);
freopen("f:/out.txt","w",stdout);
int count=0;
while(cin>>p[count].x>>p[count].y)
{
++count;
}
sort_t(p,count);
for(int i=0;i<count;i++)
{
cout<<p[i].x<<" "<<p[i].y<<endl;
}
return 0;
}

编译没问题 但是一运行 就会自动弹出 .exe已经停止工作 也没显示代码有错误之类 我是用CodeBlocks 运行的 运行结果如下
Compiling: F:\C++\1\1.cpp
Linking console executable: F:\C++\1\1.exe
Process terminated with status 0 (0 minutes, 0 seconds)
0 errors, 0 warnings

Checking for existence: F:\C++\1\1.exe
Executing: D:\Program Files\CodeBlocks/cb_console_runner.exe "F:\C++\1\1.exe" (in F:\C++\1)
Process terminated with status -1073741819 (0 minutes, 4 seconds)

哪位高手能告诉我这是什么原因
...全文
评论 5
收藏 已收藏
分享
返回顶部
ytu_ls
工具平台和程序库 24,850 成员 27,330 内容