📄 pro-r21-s.c
字号:
#include"math.h"
#include"stdio.h"
#include<stdio.h>
main()
{
FILE *fpi;
FILE *fpo;
double c1,c2,c3;
double rr[5];
double pp[5];
double tt[5];
double tt1[5];
int i,j,k; i=j=k=0;
printf("Please enter the permit slope: ");
scanf("%lf",&c3);
if((fpi=fopen("E:\\My paper\\datepick\\r21cc.txt","r"))==NULL)
/*请在“”内输入要处理的文件*/
{ printf("Can not open this file!");
exit(0); }
fpo=fopen("E:\\My paper\\datepick\\r21dd.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 + -