binary help
if you have binary code, how do you convert it to decimal.
i.e = chromo = 0101; (binary)
how do u tell computer to read that as binary or read it as decimal?
If barbie is so popular, why do you have to buy her friends?
If barbie is so popular, why do you have to buy her friends?
December 16, 2002 05:10 PM
each bit is double the one next to it...
0101 = 5, except for all that weird endian stuff
0101 = 5, except for all that weird endian stuff
In your example it will read it as octal.
Chess is played by three people. Two people play the game; the third provides moral support for the pawns. The object of the game is to kill your opponent by flinging captured pieces at his head. Since the only piece that can be killed is a pawn, the two armies agree to meet in a pawn-infested area (or even a pawn shop) and kill as many pawns as possible in the crossfire. If the game goes on for an hour, one player may legally attempt to gouge out the other player's eyes with his King.
It depends on where you are reading it from or to.
I''m fairly certain C nor C++ have a mechanism to enter a binary number - you can enter decimal, octal (use is uncommon), or hexidecimal (recommended alternative to binary).
int i = 10; //decimal
int j = 010; //octal
int k = 0xFF; //hexidecimal
If you are reading or writing to a file on disk, then you just read or write the number to disk. With C you would use fopen/fwrite/fclose. With C++ you could also use fstream and call its write method.
I''m fairly certain C nor C++ have a mechanism to enter a binary number - you can enter decimal, octal (use is uncommon), or hexidecimal (recommended alternative to binary).
int i = 10; //decimal
int j = 010; //octal
int k = 0xFF; //hexidecimal
If you are reading or writing to a file on disk, then you just read or write the number to disk. With C you would use fopen/fwrite/fclose. With C++ you could also use fstream and call its write method.
- The trade-off between price and quality does not exist in Japan. Rather, the idea that high quality brings on cost reduction is widely accepted.-- Tajima & Matsubara
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement