?? d4r28.cpp
字號:
#include <iostream.h>
#include <math.h>
#include <iomanip.h>
#include <stdlib.h>
#include <fstream.h>
#include <string>
#include <process.h>
double ex(double x)
{
double r1,r2,r3,r4,r5,r6,t1,t2,t3,t4,s1,s2,s3,s4,temp,aaa,y,w;
r1 = 0.00107857;
r2 = -0.00976004;
r3 = 0.05519968;
r4 = -0.24991055;
r5 = 0.99999193;
r6 = -0.57721566;
t1 = 8.5733287401;
t2 = 18.059016973;
t3 = 8.6347608925;
t4 = 0.2677737343;
s1 = 9.5733223454;
s2 = 25.6329561486;
s3 = 21.0996530827;
s4 = 3.9584969228;
if (x < 1.0)
{
aaa = (r1 * x + r2) * x + r3;
temp = ((aaa * x + r4) * x + r5) * x + r6 - log(x);
}
else
{
y = (((x + t1) * x + t2) * x + t3) * x + t4;
w = (((x + s1) * x + s2) * x + s3) * x + s4;
temp = (y / w) / (exp(x) * x);
}
return temp;
}
void main()
{
//program d4r28
//driver for routine ex
int i;
char text[20];
double nval,value,x;
const double pi = 3.1415926;
fstream fin;
fin.open("d:\\vc常用數值算法集\\data\\fncval.dat",ios::in);
while ( strcmp(text,"Exponential")!=0 )
{
fin>>text;
}
fin>>text;
fin>>text;
fin>>nval;
cout<<"Exponential integral Ex "<<endl;
fin>>text;
cout<<endl;
cout<<" x actual Ex(x)"<<endl;
for( i = 1; i<=nval; i++)
{
fin>>x;
fin>>value;
cout<<setw(6)<<x;
cout<<setw(18)<<value;
cout<<setw(18)<<ex(x)<<endl;
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -