Plz Help Me To Modify Program...

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • rea haris
    New Member
    • Oct 2006
    • 2

    #1

    Plz Help Me To Modify Program...

    i've tried run this program many times but i still didn't get the solution..so could someone help me to modify this coding?

    Code:
      current->h10 += hp10;
      current->h30 += hp30;
      current->c10 += cp10;
      current->c30 += cp30;
      current->d10 += dp10;
      current->d30 += dp30;
    the output should add the current value with the new user input. for example, if the current value is 1 and the user input also 1. the answer should be 2..but what i got with this coding was 11..
  • dariophoenix
    New Member
    • Oct 2006
    • 34

    #2
    Perhaps if you put the entire code, or explain... I don't know which is which

    Comment

    • apusateri
      New Member
      • Oct 2006
      • 27

      #3
      Originally posted by rea haris
      i've tried run this program many times but i still didn't get the solution..so could someone help me to modify this coding?

      Code:
        current->h10 += hp10;
        current->h30 += hp30;
        current->c10 += cp10;
        current->c30 += cp30;
        current->d10 += dp10;
        current->d30 += dp30;
      the output should add the current value with the new user input. for example, if the current value is 1 and the user input also 1. the answer should be 2..but what i got with this coding was 11..
      Do you have your variables set up as integers? int 1 + int 1 = 2, but char 1 + char 1 = 11... Other than that, I agree with the previous comment, I'd like to see some more code to know what is going on here. That was just a "quick check" I wanted to offer.

      Comment

      • Banfa
        Recognized Expert Expert
        • Feb 2006
        • 9067

        #4
        Originally posted by apusateri
        int 1 + int 1 = 2, but char 1 + char 1 = 11
        No char 1 + char 1 = 2 as well

        You may be thinking of

        string "1" + string "1" = "11"

        or

        string "1" + char '1' = "11"

        Comment

        • apusateri
          New Member
          • Oct 2006
          • 27

          #5
          Originally posted by Banfa
          No char 1 + char 1 = 2 as well

          You may be thinking of

          string "1" + string "1" = "11"

          or

          string "1" + char '1' = "11"
          You're right, meant to say string.

          My mistake.

          Comment

          Working...