pex5_8.cpp
来自「数据结构C++代码,经典代码,受益多多,希望大家多多支持」· C++ 代码 · 共 44 行
CPP
44 行
#include <iostream.h>
#include <iomanip.h>
#pragma hdrstop
#include "pex5_8.h"
void main (void)
{
Calculator C;
double x = 0.0;
int i;
cout.setf(ios::scientific);
cout.precision(14);
C.Variable();
cout << endl << setw(10) << "x" << setw(37)
<< "(x*x+1)/(x**4+x**2+5x+3)" << endl << endl;
cout << x << " " << C.Eval(x) << endl;
for(i=0, x = 10.0;i < 8;i++,x *= 10.0)
cout << x << " " << C.Eval(x) << endl;
}
/*
<Run>
Enter a postfix expression in the variable x. Terminate with '='
x 2 ^ 1 + x 4 ^ 8 x 2 ^ * + 5 x * + 3 + / =
x (x*x+1)/(x**4+x**2+5x+3)
0.00000000000000e+00 3.33333333333333e-01
1.00000000000000e+01 9.30618262231641e-03
1.00000000000000e+02 9.99295537113757e-05
1.00000000000000e+03 9.99992995053075e-07
1.00000000000000e+04 9.99999929995005e-09
1.00000000000000e+05 9.99999999299995e-11
1.00000000000000e+06 9.99999999993000e-13
1.00000000000000e+07 9.99999999999930e-15
1.00000000000000e+08 9.99999999999999e-17
*/
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?