Project2 - Electrical & Computer Engineering...

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

View Full Document Right Arrow Icon
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
Background image of page 1

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

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 10/11/2010 for the course ENEE 140 taught by Professor Staff during the Fall '08 term at Maryland.

Page1 / 4

Project2 - Electrical & Computer Engineering...

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

View Full Document Right Arrow Icon
Ask a homework question - tutors are online