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

📄 naca.cpp

📁 计算NACA4位翼型的程序,在E盘naca文件夹下生成翼型数据,保存为.txt格式
💻 CPP
字号:
#include<iostream.h>
#include<math.h>
#include<stdlib.h>
#include<fstream.h>


void f0out(double x1,double y1)
{
	
	ofstream f1("e:\\naca\\up.txt",ios::app);
    
	if(!f1)
	
	{
		
		cerr<<"e:\\naca\\down.xls file not open!"<<endl;
	   
		exit(1);
	}



	f1<<x1<<'\t'<<y1<<endl;
	f1.close();
}


void f1out(double x1,double y1)
{
	
	ofstream f1("e:\\naca\\down.txt",ios::app);
    
	if(!f1)
	
	{
		
		cerr<<"e:\\naca\\af.xls file not open!"<<endl;
	   
		exit(1);
	}



	f1<<x1<<'\t'<<y1<<endl;
	f1.close();
}





void main()
{   
    cout<<"input NACA numbers,such as 0 0 12,0 0 15,0 0 18..."<<endl;
	

	//first
	//
	//
    double t,t1,t2,t34,yf;
	cin>>t1;
	                      //cout<<t1<<endl;
	//second
	//
	//
	cin>>t2;             //cout<<t2<<endl;
	
	//t-
	cin>>t34;
	t=t34/100;          //cout<<t34<<endl;


	//x-f
    double xf=t2/10;    //cout<<xf<<endl;


	//f
	double f=t1/100;   //cout<<f<<endl;

	//rt
	double rt=1.1019*pow(t,2);

    cout<<"input how many datas you want,must be integer "<<endl;
	int i1;
	cin>>i1;
	double xstep=1.0/i1;

	double x=0.0;
	do{ 
		 
		
		 double yt=t/0.2*(0.2969*sqrt(x)-0.126*x-0.3516*pow(x,2)+0.2843*pow(x,3)-0.1015*pow(x,4));
	     //cout<<x<<" "<<y<<endl; 

		 
		 
		 
		 //
		 //中弧线方程
		 if(x<xf)
		 {
			 
			  yf=f/(xf*xf)*(2*xf*x-x*x);
			  
		 //cout<<yf<<endl;
		 
		 }
		 else{
			
			 
			 yf=f/((1-xf)*(1-xf))*((1-2*xf)+2*xf*x-x*x);
		     
		 //cout<<yf<<endl;
		 
		 }
		 
		 
		 
		 f0out(x,yf+yt);
		 f1out(x,yf-yt);
		 x=x+xstep;
	  
	}
	while(x<=1+xstep);
   system("PAUSE");
   //system("date");
}



//
//取中弧线
//

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -