多个算术方程求解器 [英] Multi arithmatic equation solver

查看:50
本文介绍了多个算术方程求解器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设在一个程序中我给出输入,如(a + b)/ c + de /((f + g)/ h,例如(1 + 4)/ 8 + 9-7 /((7+) 8)/ h输出I除了作为输入语句的答案。我将如何解析输入以找出整数和运算符来进行算术运算。在任何语言c,c + =或java



我尝试了什么:



不知道如何解析输入

suppose in a program i give input like "(a+b)/c+d-e/((f+g)/h" for example "(1+4)/8+9-7/((7+8)/h" the output I except as the answer to the input statement. How I will parse the input to find out integer and operator to make the arithmetic operation. in any language c,c+= or java

What I have tried:

no idea how to parse the input

推荐答案

例如,请参阅:是Java中有eval()函数吗? - Stack Overflow [ ^ ](除非你想编写自己的解析器)。



嵌入 Lua [ ^ 你的 C / C ++ 应用程序是一个有趣的选择。
See, for instance: Is there an eval() function in Java? - Stack Overflow[^] (unless you want to write your own parser).

Embedding Lua[^] in your C/C++ application is an interesting alternative.


这篇关于多个算术方程求解器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆