69,373
社区成员
发帖
与我相关
我的任务
分享
//main add some sentence
main()
{
double t=A,b[W]={C,D,E},bf[W],h=B,h1=B/2.0,q[W],
y0[W],y1[W],max;
int i,n=2,j,l;
FILE *fp;
if((fp=open("mydata.dat","w"))==NULL)
{
printf("can not open file.\n");
return;
}
for(l=0;l <=n;l++)
{
bianbuc(t,b,h);
t=t+h;
printf("t=%lf\n",t);
fputc(t,fp);
}
fclose(fp);
}
#include <stdio.h>
int main()
{
FILE *fp;
int i,a[5]={1,2,3,4,5},b[5];
if (NULL==(fp=fopen("wei.txt","wb")))
{
printf("the file can't open\n");
}
fwrite(a,sizeof(int),5,fp);
fclose(fp);
if (NULL==(fp=fopen("wei.txt","rb")))
{
printf("the file can't open\n");
}
fread(b,sizeof(int),5,fp);
fclose(fp);
for (i=0;i<5;i++)
printf("%d ",b[i]);
return 0;
}