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

📄 d4r29.cpp

📁 数值计算c++源代码,包括各种算法。很有用的。
💻 CPP
字号:
#include <iostream.h>
#include <math.h>
#include <iomanip.h>
#include <stdlib.h>
#include <fstream.h>
#include <string>
#include <process.h>

double ass(int n, double b)
{
	int i;
    double a[16],temp,db;
    a[1] = exp(-b) / b;
    if( n == 1)  goto yi;
    db = 1.0 / b;
    for (i = 2;i<=n;i++)
	{
        a[i] = a[1] + db * (i - 1) * a[i - 1];
	}
yi:  temp = a[n];
	 return temp;
}

void main()
{
    //program d4r29
    //driver for routine ass
    int i;
	char text[20];
    double nval,value,b,x; 
    const double pi = 3.1415926;
    fstream fin;
    fin.open("d:\\vc常用数值算法集\\data\\fncval.dat",ios::in);
    while ( strcmp(text,"Ass")!=0 )
	{
      fin>>text;
	}
    fin>>nval; 
    cout<<"Exponential Integral Ass "<<endl;
    fin>>text;
    cout<<endl;
    cout<<"     n      b           actual           ass(n,b)"<<endl;
    for( i = 1;i<=nval;i++)
	{
        fin>>x;
		fin>>b;
		fin>>value;           
		cout<<setw(6)<<x;
        cout<<setw(8)<<b;
        cout<<setw(18)<<value;
		cout<<setw(18)<<ass(x,b)<<endl;			          
    }
}

⌨️ 快捷键说明

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