What is wrong with this eqaution?

This is a discussion on What is wrong with this eqaution? within the C++ Programming forums, part of the General Programming Boards category; Code: ((fourthlastnumber * 10000) + (thirdlastnumber * 1000) + (secondlastnumber * 100) + (lastnumber * 10) + currentnumber) If fourthlastnumber ...

  1. #1
    Registered User
    Join Date
    Jun 2008
    Posts
    114

    What is wrong with this eqaution?

    Code:
    ((fourthlastnumber * 10000) + (thirdlastnumber * 1000) + (secondlastnumber * 100) + (lastnumber * 10) + currentnumber)
    If fourthlastnumber = 0,Thirdlastnumber = 0,SecondLastNumber = 0;
    Lastnumber = 1; And current number = 5;

    Shouldn't the outcome be 15?

    Well it comes out as like 105853. See an issue?
    Who needs a signature?

  2. #2
    CSharpener vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,424
    maybe it is because lastnumber and Lastnumber is different vars, or maybe another of your misspelling errors...

    show the smallest COMPILABLE example of the code that represents the problem
    The first 90% of a project takes 90% of the time,
    the last 10% takes the other 90% of the time.

  3. #3
    Registered User
    Join Date
    Jun 2008
    Posts
    114
    I have just realized that this problem is not within the eqaution for if i change the values of all the numbers before eqaution it comes out as expected. Now to bug search sorry for the false alarm.
    Who needs a signature?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 9
    Last Post: 07-15-2004, 03:30 PM
  2. Debugging-Looking in the wrong places
    By JaWiB in forum A Brief History of Cprogramming.com
    Replies: 1
    Last Post: 11-03-2003, 09:50 PM
  3. Confused: What is wrong with void??
    By Machewy in forum C++ Programming
    Replies: 19
    Last Post: 04-15-2003, 12:40 PM
  4. God
    By datainjector in forum A Brief History of Cprogramming.com
    Replies: 746
    Last Post: 12-22-2002, 11:01 AM
  5. Whats wrong?
    By Unregistered in forum C Programming
    Replies: 6
    Last Post: 07-14-2002, 01:04 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21