{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Project2

# Project2 - Electrical Computer Engineering Department...

This preview shows pages 1–2. Sign up to view the full content.

Electrical & Computer Engineering Department, University of Maryland, College Park Spring 2010 ENEE140 Dr. Gang Qu Project 2: Integer Arithmetic Expression Evaluator Posted: Sunday, April 4 Due: Wednesday 11:59 pm, April 21 (no extension) Project Objective: 1. get familiar with the process of completing a programming project. 2. learn to use and manipulate arrays. 3. understand precedence and associative rules. 4. use program selection: if , if-else , switch statements. 5. use basic loops ( while , do-while , for ) for repetition. 6. command line argument 7. read from and write into a file Project Description : In this project, you will design and implement a program to evaluate an arithmetic expression. The arithmetic expression will contain only integers, both positive and negative, and the five basic binary operators (+, -, %, /, *). Your program should read in the expression from an input file. The input file has a specific format, which is described below. After reading the expression, you are first going to evaluate all the unary signs in the expression, next you will evaluate the *, /, % operators, and finally the binary + and – operators. You will output the initial expression, intermediate steps, and the final solution to an output file as well as the monitor. A master program, in the format of executable file, and a sample input file will be provided. Input Your program will read in input from a file of multiple lines. Each line represents exactly one arithmetic expression. The first number of a line is the number of operands in the expression n ( 2 n 10 ). It is followed by n operands of integer values, and then n-1 characters (+,-,*,/,%) that represent the operators of the expression. All the numbers and characters are separated by a single space, and there are no superfluous spaces at the end of each line. Each operator will be placed between 2 consecutive operands to form the arithmetic operation. As an example, the

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 4

Project2 - Electrical Computer Engineering Department...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online