how would i get a input from user (enter a character), enter 2nd character and convert them to binary then check the haming distance between them
This is a discussion on getting input from user(character) converting to binary within the C Programming forums, part of the General Programming Boards category; how would i get a input from user (enter a character), enter 2nd character and convert them to binary then ...
how would i get a input from user (enter a character), enter 2nd character and convert them to binary then check the haming distance between them
Someone asked this very question earlier. You should search for it.
don't know what the heck a haming distance is, but I think the fact that char's are also their corresponding ASCII code might help you.
char a = 'a';
char a = 97; // same thing
...
char b;
scanf("%c",&b);
// do whatever to b, b is a number from 0 to 255
-Jake
Hazudra Fodder
im trying to get a character from user (it can be a or b or a number).... then convert it to binary i can do the hamming i just cant figure out the way to get the input and convert it to the binary