| | |
how to convert Binary numbers to decimal numbers and decimal numbers to binary
![]() |
How to convert binary numbers to decimal numbers and decimal numbers to binary numbers?
help!!!!!!
help!!!!!!
Last edited by Ancient Dragon; Feb 9th, 2009 at 7:56 pm. Reason: deleted color and bold tabs
Re: how to convert Binary numbers to decimal numbers and decimal numbers to binary
0
#2 Feb 9th, 2009
Re: how to convert Binary numbers to decimal numbers and decimal numbers to binary
0
#3 Feb 9th, 2009
If you're using an int variable for keeping a decimal value and you want to convert it into a binary value, you should know how an int is represented.
An "int" uses 32 bits for representing the number. You can use binary operators in C++ to get the bytes. (OR / AND). I suggest that you do a search on what they are and how to use them. If you don't know the binary representation, do the same.
It's very easy to print all the bytes of an int. You can use a printf option of write a loop that will iterate 32 times to print every byte of the int.
An "int" uses 32 bits for representing the number. You can use binary operators in C++ to get the bytes. (OR / AND). I suggest that you do a search on what they are and how to use them. If you don't know the binary representation, do the same.
It's very easy to print all the bytes of an int. You can use a printf option of write a loop that will iterate 32 times to print every byte of the int.
Re: how to convert Binary numbers to decimal numbers and decimal numbers to binary
0
#4 Feb 9th, 2009
![]() |
Similar Threads
- Convert negative decimal to binary (Python)
- Binary (base 2) to Decimal (base 10) HELP! (C)
- Decimal to Binary Converer (VB.NET)
- How to Converty Binary String of Length 1024 to Decimal Number (C)
- hex string to true binary w. bit manipulation (Java)
- binary to decimal (C)
- binary to decimal problem (C++)
- binary to decimal values conversion (C)
- Real number to binary? (C)
Other Threads in the C++ Forum
- Previous Thread: fps troubles
- Next Thread: C++ Debugging
Views: 1926 | Replies: 3
| Thread Tools | Search this Thread |
Tag cloud for C++
6 api array arrays beginner binary borland c++ c/c++ calculator char class classes code compile compiler console constructor conversion convert count data delete desktop dll encryption error file forms fstream function functions game givemetehcodez graph homework http iamthwee ifstream input int java lazy lib link linker list loop looping loops map math matrix memory newbie news number objects output pointer pointers problem program programming project python qt random read recursion recursive reference return search sort sorting spoonfeeding string strings struct student studio system template templates text tree url variable vc++ vector video visual visualstudio win32 window windows winsock wordfrequency wxwidgets





