CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums
Results 1 to 3 of 3

Thread: binary to decimal

  1. #1
    Join Date
    Oct 2007

    binary to decimal

    I need to write a program that takes a user inputed binary "1001101" and turns it into decimal form. I know how to switch from digit to digit using modulus and /. I just dont know how to take the digits and assign a value from there. Any suggestions on what i can do?

    This is my 2nd program so anything advanced i probably wont know.

  2. #2
    Join Date
    Feb 2000
    Indore, India

    Re: binary to decimal


    I hope that this FAQ Integer to string and vice-verca for any base will be of use.

    Let me know if I have helped by rating this post

    Recent FAQs

    Drag an image
    Area of a window exposed on desktop
    Display rotated bitmap

  3. #3
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Hanover Germany

    Re: binary to decimal

    Another way - using strtol (or _tcstol) C-runtime function with the base set to 2.
    Victor Nijegorodov

Posting Permissions

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

Windows Mobile Development Center

Click Here to Expand Forum to Full Width

On-Demand Webinars (sponsored)