?? pro-w.c
?? 按照既定的步長
?? C
字號:
??
#include"math.h"
#include"stdio.h"
#include<stdio.h>
main()
{
FILE *fpi;
FILE *fpo;
double c1,c3;
double rr[6];
double pp[6];
double tt[6];
int i,j,k; i=j=k=0;
printf("Please enter the step: ");
scanf("%lf",&c3);
if((fpi=fopen("E:\\data\\wxf1.txt","r"))==NULL)
/*請?jiān)凇啊眱?nèi)輸入要處理的文件*/
{ printf("Can not open this file!");
exit(0); }
fpo=fopen("E:\\data\\wxf2.txt","a");
/*請?jiān)凇啊眱?nèi)輸入存放結(jié)果的文件*/
while(fscanf(fpi,"%lf%lf%lf%lf%lf%lf",&rr[0],&rr[1],&rr[2],&rr[3],&rr[4],&rr[5])>0)
{ k++;
c1=rr[1]-pp[1];
if(fabs(c1)>c3)
{ if(k>1)
fprintf(fpo,"%-8.3lf %8.4lf %8.3lf %8.3lf %8.3lf %8.0lf\n",tt[0],tt[1],tt[2],tt[3],tt[4],tt[5]);
for(j=0;j<6;j++)
pp[j]=rr[j];
fprintf(fpo,"%-8.3lf %8.4lf %8.3lf %8.3lf %8.3lf %8.0lf\n",pp[0],pp[1],pp[2],pp[3],pp[4],pp[5]);
k=0;
}
for(j=0;j<6;j++)
tt[j]=rr[j];
}
if(k>0)
fprintf(fpo,"%-8.3lf %8.4lf %8.3lf %8.3lf %8.3lf %8.0lf\n",tt[0],tt[1],tt[2],tt[3],tt[4],tt[5]);
fclose(fpi);
fclose(fpo);
exit(0);
getch(); /* 請不要刪除此行 */
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -