?? pro-r21.c
字號:
#include"math.h"
#include"stdio.h"
#include<stdio.h>
main()
{
FILE *fpi;
FILE *fpo;
double c1,c2,c3;
double rr[7];
double pp[5];
double tt[5];
double tt1[5];
int i,j,k; i=j=k=0;
printf("Please enter the step: ");
scanf("%lf",&c3);
if((fpi=fopen("E:\\My paper\\datepick\\r21aa.txt","r"))==NULL)
/*請在“”內輸入要處理的文件*/
{ printf("Can not open this file!");
exit(0); }
fpo=fopen("E:\\My paper\\datepick\\r21bb.txt","a");
/*請在“”內輸入存放結果的文件*/
fprintf(fpo,"PowH\(kN\) DispH\(mm\) PowV\(kN\) DispV\(mm\) Time\(s\)\n");
while(fscanf(fpi,"%lf%lf%lf%lf%lf%lf%lf",&rr[0],&rr[1],&rr[2],&rr[3],&rr[4],&rr[5],&rr[6])>0)
{ k++;
tt[0]=rr[0];
tt[1]=(rr[1]+rr[2])/2;
tt[2]=rr[3];
tt[3]=(rr[4]+rr[5])/2;
tt[4]=rr[6];
c1=tt[1]-pp[1];
c2=tt[3]-pp[3];
if(fabs(c1)>c3||fabs(c2)>c3)
{ if(k>=2)
fprintf(fpo,"%-8.3lf %8.5lf %8.3lf %8.5lf %8.0lf\n",tt1[0],tt1[1],tt1[2],tt1[3],tt1[4]);
for(j=0;j<5;j++)
pp[j]=tt[j];
fprintf(fpo,"%-8.3lf %8.5lf %8.3lf %8.5lf %8.0lf\n",pp[0],pp[1],pp[2],pp[3],pp[4]);
k=0;
}
tt1[0]=tt[0]; tt1[1]=tt[1]; tt1[2]=tt[2]; tt1[3]=tt[3]; tt1[4]=tt[4];
}
if(k>0)
fprintf(fpo,"%-8.3lf %8.5lf %8.3lf %8.5lf%8.0lf\n",tt[0],tt[1],tt[2],tt[3],tt[4]);
fclose(fpi);
fclose(fpo);
exit(0);
getch(); /* 請不要刪除此行 */
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -