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

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

View Full Document Right Arrow Icon
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.
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.

Page1 / 2

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

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