📄 pro-r01.c
字号:
#include"math.h"
#include"stdio.h"
#include<stdio.h>
main()
{
FILE *fpi;
FILE *fpo;
double c1,c2,c3;
double rr[7];
double pp[3];
double tt[3];
double tt1[3];
int i,j,k; i=j=k=0;
printf("Please enter the step: ");
scanf("%lf",&c3);
if((fpi=fopen("E:\\My paper\\datepick\\r01aa.txt","r"))==NULL)
/*请在“”内输入要处理的文件*/
{ printf("Can not open this file!");
exit(0); }
fpo=fopen("E:\\My paper\\datepick\\r01bb.txt","a");
/*请在“”内输入存放结果的文件*/
fprintf(fpo,"Pow\(kN\) Disp\(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=k+1;
tt[0]=rr[0];
tt[1]=(rr[1]+rr[2])/2;
tt[2]=rr[6];
c1=tt[1]-pp[1];
if(fabs(c1)>c3)
{ if(k>=2)
fprintf(fpo,"%-8.3lf %8.5lf %8.0lf\n",tt1[0],tt1[1],tt1[2]);
for(j=0;j<3;j++)
pp[j]=tt[j];
fprintf(fpo,"%-8.3lf %8.5lf %8.0lf\n",pp[0],pp[1],pp[2]);
k=0;
}
tt1[0]=tt[0]; tt1[1]=tt[1]; tt1[2]=tt[2];
}
if(k>0)
fprintf(fpo,"%-8.3lf %8.5lf %8.0lf\n",tt[0],tt[1],tt[2]);
fclose(fpi);
fclose(fpo);
exit(0);
getch(); /* 请不要删除此行 */
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -