回复 3楼 word123
因为是工程建模,我后头需要分段再输入一系列的点的坐标,可是又提示位置冲突了,是怎么回事啊?
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
typedef struct
{double mess;
double x;
double y;
double z;
}POINT;
POINT std,pers[19640];
void main()
{double i,j,k,a,b,c;
int t=0;
FILE *fp;
fp=fopen("D:\\a.txt","wb+");
if (fp==0)
printf("can't open this file");
for (i=0.0;i<=50;i+=0.5)
for(j=0.0;j<=1;j+=0.5)
for(k=0.0;k<=20;k+=0.5)
if(k<=-i+50)
{pers[t].mess=261.97;
pers[t].x=i;
pers[t].y=j;
pers[t].z=k;
fprintf(fp,"%lf %lf %lf %lf\r\r\n",pers[t].mess,pers[t].x,pers[t].y,pers[t].z);
t++;}
for(a=0.0;i<=110;i+=0.5)
for(b=0.0;b<=1;j+=0.5)
for(c=-15.0;c<=0;c+=0.5)
{pers[t].mess=261.97;
pers[t].x=a;
pers[t].y=b;
pers[t].z=c;
fprintf(fp,"%lf %lf %lf %lf\r\r\n",pers[t].mess,pers[t].x,pers[t].y,pers[t].z);
t++;}
fclose(fp);
system("pause");
}