📄 苍蝇密度.cpp
字号:
// 苍蝇密度.cpp : 定义控制台应用程序的入口点。
//
#include "stdafx.h"
#include<iostream.h>
#include<stdio.h>
int _tmain(int argc, _TCHAR* argv[])
{
int n;
float x=0;
for(n=0;n<100;n++)
{
cout<<"X("<<n<<")="<<x<<" ";
FILE *fp;
if((fp=fopen("E:\\file.dat","a+"))==NULL)
{
cout<<"Can not open this file."<<endl;
//exit(0);
}
fprintf(fp,"%f ",x);
fclose(fp);
x=11-0.01*x*x;
cout<<"X("<<n+1<<")="<<x<<endl;
if((fp=fopen("E:\\file.dat","a+"))==NULL)
{
cout<<"Can not open this file."<<endl;
//exit(0);
}
fprintf(fp,"%f\n",x);
fclose(fp);
}
return 0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -