For those less mathematically inclined a code example of what wysota is saying:
#include <iostream>
int main(int argc, char *argv[])
{
int myBase10 = 15; //15 in decimal
int myBase8 = 017; //15 in octal
int myBase16 = 0x000F; //15 in hex (leading zeros just to remind me that this is a 32 bit representation...its a personal preference 0xF would do )
if( (myBase10 == myBase16) && (myBase10 == myBase8) && (myBase16 == myBase8) )
{
std::cout << "They are all Equal, Under the Hood the Computer sees each of these as a 32 bit(because typed as int) base2 Number" << std::endl;
std::cout << "eg.( 0000000000001111 )(little endian order listed)" << std::endl;
std::cout << "It is the language and Compiler that give you the convenience of thinking in hex/octal/decimal..." << std::endl;
}//end if all ints are equal
return( 0 );
}//end main
#include <iostream>
int main(int argc, char *argv[])
{
int myBase10 = 15; //15 in decimal
int myBase8 = 017; //15 in octal
int myBase16 = 0x000F; //15 in hex (leading zeros just to remind me that this is a 32 bit representation...its a personal preference 0xF would do )
if( (myBase10 == myBase16) && (myBase10 == myBase8) && (myBase16 == myBase8) )
{
std::cout << "They are all Equal, Under the Hood the Computer sees each of these as a 32 bit(because typed as int) base2 Number" << std::endl;
std::cout << "eg.( 0000000000001111 )(little endian order listed)" << std::endl;
std::cout << "It is the language and Compiler that give you the convenience of thinking in hex/octal/decimal..." << std::endl;
}//end if all ints are equal
return( 0 );
}//end main
To copy to clipboard, switch view to plain text mode
Bookmarks