Thread: Desperate to get help w/ program

  1. #1

    Angry Desperate to get help w/ program

    I'm not asking anyone to do my homework but I am desperate to get help. I need a huge boost in the right direction. My program is to calculate the value of an expression involving arithmetic operators. The expression should be evaluated based on operator precedence. The program should prompt the user to input the expression and should indicate the end of the expression by inputting a character E. The expression should have only numeric values and operators to add, subtract, multiply, and divide.

    -The program should prompt the user to input only integer values
    -the program should be written for integer values in the expression
    -Arrays should be used to store the input values of the user
    -Output of the program should be an integer value
    -Functions can be used if necessary
    here is an example that a user might enter
    the program should display the correct answer and the numbers stored as integers and the operators stored as char. Please someone help me out anyway you can. Thank you.

  2. #2
    Registered User
    Join Date
    Sep 2001
    Are parentheses allowed? Like:



    Is whitespace valid? So, would:
    1        + 4/    2        E
    be valid?

    Also, are there limits to the maximum number of numbers/operators?

    How much have you learned? These problems can be solved with a stack, but I don't know if you've learned about that. You can also use recursion to solve this.
    Last edited by The V.; 10-13-2001 at 01:21 PM.

  3. #3
    no recursion is NOT allowed, yes white spaces can be used and the maximum will be around 500 integers or so, depending on what i want it to be. and no pointers allowed either.

  4. #4
    Is the use of parenthesis allowed? Without recursion, this is much more difficult. Parenthesis processing is way easier with recursion. You can of course, fake recursion, using a loop. This isn't nearly as clean to read, but it can be done.


  5. #5
    we can also right the program so it goes like this:
    and then it produces the answer
    is that easier than the way i said before?
    Thank you.

  6. #6
    the way i just said, the:
    i mean by that the user types in a number, hits return, enters an operation, then another number and so on.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Using variables in system()
    By Afro in forum C Programming
    Replies: 8
    Last Post: 07-03-2007, 12:27 PM
  2. BOOKKEEPING PROGRAM, need help!
    By yabud in forum C Programming
    Replies: 3
    Last Post: 11-16-2006, 11:17 PM
  3. Can someome help me with a program please?
    By WinterInChicago in forum C++ Programming
    Replies: 3
    Last Post: 09-21-2006, 10:58 PM
  4. My program, anyhelp
    By @licomb in forum C Programming
    Replies: 14
    Last Post: 08-14-2001, 10:04 PM