⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 苍蝇密度.cpp

📁 用于交通流研究的Wolfram模型的程序
💻 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 + -