# The Magnificent Online Command-line Calculator
Please help me to debug it by throwing everything you can
at it. Currently, only integers are supported.
If you don't want to compile and run it locally, fire up
your terminal and enter the following command:
$ nc 173.18.215.230 9999
I have a RaspberryPi sitting next to me whose sole purpose
is currently to act as _The Magnificent Online Command-line
Calculator_. You can even send commands directly to it,
and pipe the data back.
If you want to try running the server-side code yourself,
check out the `server` branch.
### Allowed operators
`+` Addition
`-` Subtraction
`*` Multiplication
`/` Division (integer division only!)
**parentheses** determine the order of operations
**spaces** between numbers and operators are ignored
### Usage and Examples
It can be run in one of two ways, **command-line mode** and **interactive mode**.
If any arguments are detected, it runs as **command-line mode**, treating all arguments as a calculator would. This output can be piped as you would with any other command.
$ eval-test 1 + 2
3
$ eval-test 1+(-20)*46/-2
437
If no arguments are passed, it runs as **interactive mode**
$ eval-test
Enter a calculation: 1+2
> 3
Enter a calculation: 1+(-2)*4/-2
> 2
In interactive mode, press `CTRL+C` at any time to exit the program.
### Bugs and future work
Please help me to debug it by throwing everything you can
at it. If it returns a "readable" error message (such as
_"Nothing inside the parentheses"_, that's okay, and means
I know about the problem, and am handling it properly.
The types of bugs you should tell me about are:
* Incorrect values returned by calculations
* Just quitting or crashing for no reason whatsoever
* Feature requests
Submit bugs or ideas to the following GitHub repo:
* http://www.github.com/IQAndreas/eval.cpp
**Known issues:**
* Order of operations is ignored; everything is parsed
from left to right, regardless of operator type.
_(do you have any idea how hard tricky this is to do
elegantly and without repeated code?!? I'm going
to have to re-write everything if I want some sort
of order of operations system! (which I may do))_
* Only handles 32 bit signed integers
_(max values of **-2,147,483,648** to **2,147,483,647**)_
* No floats, only integer division is allowed
_(this was on purpose, actually, since I created it
for a very specific project. This could change now)_
没有合适的资源?快使用搜索试试~ 我知道了~
eval.cpp:C ++中的基本数学解析器(仍在进行中,实际上是针对另一个项目;我最终使它比预期的更完整)
共10个文件
cpp:6个
md:1个
gitignore:1个
需积分: 20 3 下载量 118 浏览量
2021-05-08
17:04:06
上传
评论
收藏 12KB ZIP 举报
温馨提示
宏伟的在线命令行计算器 请全力以赴,帮助我调试它。 当前,仅支持整数。 如果您不想在本地编译和运行它,请启动您的终端并输入以下命令: $ nc 173.18.215.230 9999 我旁边有一个RaspberryPi,其唯一目的是当前充当The Magnificent Online Command-Line Calculator 。 您甚至可以直接向其发送命令,然后将数据通过管道传输回去。 如果要尝试自己运行服务器端代码,请签出server分支。 允许的运营商 +加法-减法*乘法/部门(仅限整数除法!) 括号确定操作顺序数字和运算符之间的空格将被忽略 用法与范例 它可以通过两种方式之一运行:命令行方式和交互方式。 如果检测到任何参数,它将以命令行方式运行,将所有参数视为计算器。 可以像使用任何其他命令一样通过管道传输此输出。 $ eval-test 1 + 2 3 $ eva
资源详情
资源评论
资源推荐
收起资源包目录
eval_cpp-master.zip (10个子文件)
eval.cpp-master
.gitignore 35B
README.md 2KB
server
server.sh 748B
src
eval-test.cpp 4KB
eval-help.cpp 2KB
eval-server.cpp 3KB
Makefile 735B
lib
eval.cpp 8KB
error.cpp 3KB
eval-errors.cpp 3KB
共 10 条
- 1
铭哲友野
- 粉丝: 29
- 资源: 4534
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论0