Results 1 to 4 of 4

Thread: i need a syntax for this program.please!

  1. #1

    Thread Starter
    New Member
    Join Date
    Mar 2008
    Posts
    3

    i need a syntax for this program.please!

    Assume the following rules of precedence for expressions:
    Highest is addition (+)
    then subtraction (-)
    then multiplication (*)
    then division (/)

    Evaluate inputs such as:
    (a) 1+4*3-2/2 Output: 5*3-2/2 = 5*1/2 = 5/2 = 2.5
    (b) 5-2/2+1*2 Output: 5-2/3*2 = 3/3*2 = 3/6 = 0.5
    (c) 3-2+4-2+5 Output: 3-6-7 = -3 - 7 = -10

    Output up to 5 decimal places if long.

  2. #2
    Frenzied Member HanneSThEGreaT's Avatar
    Join Date
    Nov 2003
    Location
    Vereeniging, South Africa
    Posts
    1,492

    Re: i need a syntax for this program.please!

    Is this a homework question.

    The order of precedence as I know it, evaluates + and - last, so I don't really get what you're trying to ask
    VB.NET MVP 2008 - Present

  3. #3
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: i need a syntax for this program.please!

    I've no doubt that this IS homework and it hasn't even been posted with so much as a please help. I suggest that you try to do your own homework and if you have a specific question then ask it. Just posting here what your teacher gave you is the height of laziness.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  4. #4
    PowerPoster
    Join Date
    Nov 2002
    Location
    Manila
    Posts
    7,629

    Re: i need a syntax for this program.please!

    Please refer to your other post in http://www.vbforums.com/showthread.php?t=515149

    As to the source code, you will have to learn how to interpret and implement narrative description of requirements and design while you have the luxury of time to do so in school.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width