English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

4 answers

Every character is assigned a unique code, to translate a string representation of a letter in the alphabet, you merely have to look up the code for that particular character, then convert that decimal representation to binary.

For example:
'a' - 97

97 in binary is : 1100001


64 | 32 | 16 | 8 | 4 | 2 | 1
1 1 0 0 0 0 1

64 + 32 + 1 = 97

2006-11-08 12:42:57 · answer #1 · answered by zesturian 2 · 1 2

Binary Letter Converter

2016-12-26 15:51:48 · answer #2 · answered by ? 4 · 0 0

You have to create an algorithm to convert the number into a binary number. I always use an array of bools to represent a binary number. The following function will cout the binary equivalent of an 8-bit binary number: void showBinary(int num) { bool bin[8]; for(int i=0; i<8; i++) { bin[7 - i] = num%2? true : false; num /= 2; } for(int i=0; i<8; i++) { cout << bin[i]? "1" : "0"; } }

2016-03-17 06:45:28 · answer #3 · answered by ? 4 · 0 0

An explanation of binary: http://www.mindspring.com/~jimvb/binary.htm

And a converter:
http://students.washington.edu/cwei/tools/binary.shtml

2006-11-08 12:40:08 · answer #4 · answered by Snoopy 5 · 1 1

fedest.com, questions and answers