2 u014207060 u014207060 于 2014.03.18 23:34 提问

关于 desk calculator 程序

Project 1: Desk Calculator
This project requires you to write a program that imitates a simple desk
calculator. Your calculator must be able to accept an infix expression which at least
includes (, ), +, -, *, /, %, and ^ (exponentiation operator, a^b = a ). If the expression is
legal, output its value, else output an error message.

Input Specification:

ourprogrammustreadtestcasesfromafile“input.txt”. In the file there are
several test cases, each occupies one line that contains an infix expression. Proceed until the end of the file.

Output Specification:

for each test case,output to a file “output.txt”in one line the value of that
expression(accurate up to two decimalplaces),or an error message“ERROR"

Csdn user default icon