【练习3.19】

编写一个程序计算后缀表达式的值。

 

Answer:

计算的方法书上说得很明白了,看代码行,没写错误检测【因为懒】。

测试代码:

 

 1 #include <iostream>
 2 #include "stack.h"
 3 using namespace std;
 4 using namespace stack;
 5 template class Stack<int>;
 6 int main(void)
 7 {
 8     calexp item[] = { (4.99), (1.06), ('*'), (5.99), ('+'), (6.99), (1.06), ('*'), ('+') };
 9     cout << postfix_exp(item, 9) << endl;
10         
11     system("pause");
12 }
View Code

相关文章:

  • 2021-10-16
  • 2022-12-23
  • 2021-12-11
  • 2021-06-04
  • 2021-08-02
  • 2021-10-08
  • 2022-02-04
  • 2021-12-19
猜你喜欢
  • 2022-01-18
  • 2022-01-19
  • 2022-02-18
  • 2021-10-26
  • 2022-01-25
  • 2021-11-23
  • 2021-07-08
相关资源
相似解决方案