作者peggypiano (大N)
看板Programming
标题[问题] e^x相关题目
时间Wed Jul 17 12:26:49 2013
这一题的题目我看不太懂QQ
有人能帮忙解释一下吗?
我就我所理解的先打出来,麻烦帮忙指正了谢谢><
------
The value e^x can be approximated by the sum
1 + x^1/1! + x^2/2! + x^3/3! +.........+ x^n/n!
Write a program that takes a value x as input and outputs this sum for n
taken to be each of the values 1 to 100.
//Q1:让使用者可以输入x,并分别输出n=1(即1+x^1/1!),..,n=100(即1+...+x^100/100!)
还是 输出n=1(即x^1/1!), n=2(即x^2/2!),...,n=100(即x^100/100!)呢?
The program should also output e^x calculated using the predefined
function exp. The function exp is a predefined function such that exp(x)
returns an approximation to the value e^x.
//还要输出e^x的值(使用者输入之x, n为无限大)(收敛值?)
//Q2: predefined function exp,是指要我先写一个exp()出来吗?
The function exp is in the library with the header file cmath. Your program
should repeat the calculation for new values of x until the user says she or
he is through.
//Q3:这句我超不懂QQ 是跟我说在<cmath>里有exp可以参考的意思吗 囧
第2句我不懂他的意思,不是已经让user输入过x了吗@_@ repeat the calculation
是? new value of x是? 直到user怎样呢QQ?
Use variables of type double to store the factorials or you are likely to
produce integer overflow (or arrange your calculation to avoid any direct
calculation of factorials).
//Q4: 用double变数去储存factorials(n!的值吗?),不然可能会有整数
变数漏掉浮点数、无法进行有浮点数的除法计算的问题? 或是避免计算中直接去
计算factorials??这是什麽意思呢QQ
100 lines of output might not fit comfortably on
your screen. Output the 100 output values in a format that will fit all 100 values on the screen. For
example, you might output 10 lines with 10 values on each line.
请我每10行输出10个值?
麻烦大家帮忙看看了 谢谢QQ
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 1.175.137.110
※ 编辑: peggypiano 来自: 1.175.137.110 (07/17 12:27)
1F:→ MOONRAKER:你的id很熟 是不是重修好几次了 |D 1.34.60.15 07/17 22:15
2F:→ fkmt:该不会嘉大吧 140.109.127.8 07/19 11:15
3F:→ peggypiano:我第一次修@@ 1.175.137.110 07/19 12:09
4F:→ peggypiano:f大也是吗?? 1.175.137.110 07/19 12:21