由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Computation版 - 准备100个包子求大神帮下忙or up to 50刀
相关主题
Matlab逻辑运算符区别请问 Python list comprehension
关于计算机找工作,有经验师兄师姐请帮下小弟integration question
emergency: two ACM transactions又一个菜鸟问题
请教一个Perl中CGI的使用问题(是Mastering Perl for Bioinformatics中的例子)[转载] 问个误差估计的问题
MATLAB图中有一组curve,怎么画一个小椭圆把这些curve圈一下[转载] 做FFT的陷阱
请教如何用MATLAB去fit一个多项式?ABAQUS中 FindpatchCenter 出错求助
Fortran 和 C的区别? (转载)crystal help!
请教一个c++问题a question about Matlab fread
相关话题的讨论汇总
话题: syntax话题: input话题: rpn话题: error话题: notation
进入Computation版参与讨论
1 (共1页)
Y********6
发帖数: 28
1
马上去找人买100个包子,求哪位大神能赐教帮忙提点一下怎么写下面这个project,谢
谢啦
不好意思,学了几节课又不知道怎么入手了。。想了一周实在不知道怎么写出来,不知
道怎么一个个调取然后分析,感觉很多变量和变化情况,直接写code好像太复杂了
题目是
In reverse Polish notation the operators follow their operands;
To add 3 and 4, one would write "3 4 +" rather than "3 + 4".
If there are multiple operations, the operator is given immediately after
its second operand
The expression written "3 − 4 + 5” would be written "3 4 − 5 +"
in RPN: first subtract 4 from 3, then add 5 to that
An advantage of RPN is that it obviates the need for parentheses that are
required by infix notation.
* Produce a Reverse Polish Notation calculator that operates on input files.
* First, ask the user for the location of an input file. Open this file.
* Read in the input file, and interpret the input data as RPN. Each new line
should be interpreted as its own math problem.
* Display the resulting answers to the screen.
* If a math problem has an error in its syntax, display SYNTAX ERROR for
that line and continue with the next problem.
* Do not support unary operators.
* Add support for the following operators, written exactly as shown: + - * /
% pow
* Math problems are guaranteed to not have more than 5 total operands. As a
result, you do not need to use arrays (which we have not yet covered).
Sample Input:
3 4 5.0 * −
7
4. * 8 30 +
banana
9 10 + 30 -
Sample Output:
-17
7
SYNTAX ERROR
SYNTAX ERROR
-11
At student request, we've added some additional examples:
4. 7 3-+ 2 -3+
900 40.65-20+
45.2 23.999%
Results:
9
879.35
22
谢谢
1 (共1页)
进入Computation版参与讨论
相关主题
a question about Matlab freadMATLAB图中有一组curve,怎么画一个小椭圆把这些curve圈一下
请帮我看看这个MPI_Scatter() 问题请教如何用MATLAB去fit一个多项式?
MatLab program problem, how to use the memory wisely?Fortran 和 C的区别? (转载)
Matlab 3D Matrix Operation Problem请教一个c++问题
Matlab逻辑运算符区别请问 Python list comprehension
关于计算机找工作,有经验师兄师姐请帮下小弟integration question
emergency: two ACM transactions又一个菜鸟问题
请教一个Perl中CGI的使用问题(是Mastering Perl for Bioinformatics中的例子)[转载] 问个误差估计的问题
相关话题的讨论汇总
话题: syntax话题: input话题: rpn话题: error话题: notation