Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: write an assignment statement that performs the following operation: adds 2 to a  (Read 7497 times)

0 Members and 1 Guest are viewing this topic.

nealr

    Topic Starter


    Starter

    I'm just starting to learn programming. I understand part of the question, but I'm not sure when it asks to store the result in b. Can someone help?

    Dusty



      Egghead

    • I could if she would, but she won't so I don't.
    • Thanked: 75
    • Experience: Beginner
    • OS: Windows XP
    Welcome to the CH forums.

    This sounds very much like homework, if you don't understand the question you should ask your tutor for advice. 

    Here is a definition of an asignment statement:
    Quote
        An executable statement that defines or redefines a variable based on the result of expression evaluation.

    As a general rule we don't do homework but ...

    A=A + 2

    redefines the variable A to the result of expression evaluation A + 2

    Good luck with your studies.

    One good deed is worth more than a year of good intentions.

    nealr

      Topic Starter


      Starter

      I understand you don't like to help with homework, but I'm stuck. I understand everything you just put in your answer. The part I don't understand is when it says to store the result in b. What does that mean? I know how to add 2 to a.

      Dusty



        Egghead

      • I could if she would, but she won't so I don't.
      • Thanked: 75
      • Experience: Beginner
      • OS: Windows XP
      Oops, sorry about that, I should have paid more attention to your post.

      Have a look at this:

      b=a + 2

      So if the value stored in a is 10 then the value stored in b would be 12 (a + 2).

      Hope this helps

      One good deed is worth more than a year of good intentions.

      nealr

        Topic Starter


        Starter

        Never mind. I figured it out. The answer is b=2+a. Thanks anyway.

        Dusty



          Egghead

        • I could if she would, but she won't so I don't.
        • Thanked: 75
        • Experience: Beginner
        • OS: Windows XP
        Beat you by just one minute.  Which language are you studying?

        One good deed is worth more than a year of good intentions.

        nealr

          Topic Starter


          Starter

          It's not a specific language. It's logic and design. I understand most of what I have learned so far, but there is so much different stuff, it stumps me some times.