📄 tf.cpp
字号:
#include "stdio.h"
#include "stdlib.h"
//#include "math.h"
void main()
{
FILE *fp;
float a[1500][10];
int i,j;
if((fp=fopen("data31.dat","rb"))==NULL)
{printf("cannot open file!");
exit(0);}
for(j=0;j<10;j++)
{
for(i=0;i<1500;i++)
{
fscanf(fp,"%f",&a[i][j]);
if(a[i][j]>=1.e5)
a[i][j]=1.e5;
else if( a[i][j]<=-1.e5)
a[i][j]=-1.e5;
if(abs(a[i][j])<=1.0)
a[i][j]=0;
a[i][j]=a[i][j]/1.e5;
}
}
fclose(fp);
/////////////////////////////////////写到文件中
if((fp=fopen("data32.dat","wb"))==NULL)
{printf("cannot open file!");
exit(0);}
for(i=0;i<1500;i++)
for(j=0;j<10;j++)
{ fprintf(fp,"%f ",a[i][j]);
if((j+1)%10==0)
fprintf(fp,"\n");}
fclose(fp);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -