> 其他 >
哪位高手帮忙用C++做一个求复杂表达式的计算器~
RT,要满足下列要求,不胜感激啊~
(1)数值:包括整数和实数,数值可带正、负号.
(2)一般运算符:正号、负号、加、减、乘、除、求模和乘方,其中可以包括括号.
(3)单词(即运算函数):abs、sqrt、exp、ln、log10、sin、cos和tanh.
例如:输入一个表达式: 2*sqrt(16)-(-3+5)*(-5),得到运算结果18
人气:162 ℃ 时间:2020-06-15 12:10:06
解答
#include "iostream"
#include "math.h"
#include "cstring"
using namespace std;
const int MaxSize=300;
int trans(char *exp,char postexp[]);
double compvalue(char *postexp);
int main(int argc,char* argv[])
{
char exp[300],postexp[400];
cout
推荐
猜你喜欢
© 2024 79432.Com All Rights Reserved.
电脑版|手机版