编程介的小学生 2017-05-25 05:24 采纳率: 20.5%
浏览 774
已采纳

Simple Desk Calculator

Problem Description
Your task are to write a program that imitates a simple desk calculator. Your calculator must be able to accept an infix expression which at least includes (, ), +, -, *, /,% . If the expression is legal, output its value, else ouput an error message.

Input
There are several test cases, each occupies one line that contains an infix expression. Proceed until the end of the file.

Output
For each test case, in one line the value of that expression ( accurate up to two decimal places), or an error message “ERROR IN INFIX NOTATION”.

Sample Input
4.99+5.99+6.99*1.06
(3*5*(4*8)%2)
1+2(
2/0
2.5%2
2%2.5

Sample Output
18.39
0.00
ERROR IN INFIX NOTATION
ERROR IN INFIX NOTATION
ERROR IN INFIX NOTATION
ERROR IN INFIX NOTATION

  • 写回答

2条回答 默认 最新

查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 luckysheet
  • ¥25 关于##爬虫##的问题,如何解决?:
  • ¥15 ZABBIX6.0L连接数据库报错,如何解决?(操作系统-centos)
  • ¥15 找一位技术过硬的游戏pj程序员
  • ¥15 matlab生成电测深三层曲线模型代码
  • ¥50 随机森林与房贷信用风险模型
  • ¥50 buildozer打包kivy app失败
  • ¥30 在vs2022里运行python代码
  • ¥15 不同尺寸货物如何寻找合适的包装箱型谱
  • ¥15 求解 yolo算法问题