+ 1
How to use the binary numbers in a c++ program
2 RĂ©ponses
+ 1
first you have to create the variables. it most be int type:
int b,h;
then you can assign its value. in this example I created two variables, b for binary and h for hexadecimal:
b=0b10;
h=0x10;
if you print it:
cout<<b<<endl;
cout<<h<<endl;
the result:
2
16
remember 10 on binary is 2 on decimal. and 10 on hexa is 16 on decimal.
0
ok