hw04 - CS 159 Spring 2011 HW#04 5 Points Possible Due March...

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

CS 159 – Spring 2011 HW #04 – 5 Points Possible Due: March 7, 2011 at 11:00pm Problem: Given an expression with three operands and two operators as input, evaluate the expression while following the rules of operator precedence. Example Execution #1: Enter the expression in the form [int char int char int]: 4 + 5 + 6 (4 + 5) + 6 = 15 Example Execution #2: Enter the expression in the form [int char int char int]: 4 - 5 + 6 (4 - 5) + 6 = 5 Example Execution #3: Enter the expression in the form [int char int char int]: 4 * 5 / 2 (4 * 5) / 2 = 10 Example Execution #4: Enter the expression in the form [int char int char int]: 3 + 17 % 3 3 + (17 % 3) = 5 Example Execution #5: Enter the expression in the form [int char int char int]: 33 % 12 / 2 (33 % 12) / 2 = 4 Example Execution #6 (result of dividing by zero is a crash): Enter the expression in the form [int char int char int]: 2 + 17 / 0 Arithmetic Exception Additional Requirements: Your program MUST make good use of user-defined functions.

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.

This note was uploaded on 04/11/2011 for the course CS 159 taught by Professor Crum during the Spring '08 term at Purdue.

Page1 / 2

hw04 - CS 159 Spring 2011 HW#04 5 Points Possible Due March...

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

View Full Document
Ask a homework question - tutors are online