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

Thread: binary to decimal

  1. #1
    Join Date
    Oct 2007
    Posts
    11

    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
    Location
    Indore, India
    Posts
    1,046

    Re: binary to decimal

    Hello,

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

    Regards,
    Pravin.
    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 online now Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    19,562

    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)