cool, raw code.  But did you just make the values up or are they accurate?
 
----- Original Message -----
From: Florian Zschocke
Sent: Saturday, December 15, 2001 7:54 AM
To: [EMAIL PROTECTED]
Subject: Re: [hlcoders] Binary (wtf?) (Updated)
 
> Just cuz I'm on a coders list doesn't mean I know anything about Binary...

No, I meant something like this:

#include <stdio.h>
#include <string.h>

int main( void ) {

  char str[20];
  int pos = 0;

  for ( int i = 65; i < 91; i++ ) {
    memset( str, 0, 20 );
    str[0] = i;
    strcat( str, " == " );
    pos = 4+8;
    for ( int bit = 0; bit < 8; bit++ ) {
      str[pos] = (( i&(1<<bit) ) ? '1' : '0');
      pos--;
    }

    strcat( str, "   " );
    fprintf( stdout, "%s", str );

    memset( str, 0, 20 );
    str[0] = i + 32;
    strcat( str, " == " );
    pos = 4+8;
    for ( int bit = 0; bit < 8; bit++ ) {
      str[pos] = (( (i+32)&(1<<bit) ) ? '1' : '0');
      pos--;
    }

    strcat( str, "   " );
    fprintf( stdout, "%s\n", str );
  }
}


Output:

A == 01000001   a == 01100001
B == 01000010   b == 01100010
C == 01000011   c == 01100011
D == 01000100   d == 01100100
E == 01000101   e == 01100101
F == 01000110   f == 01100110
G == 01000111   g == 01100111
H == 01001000   h == 01101000
I == 01001001   i == 01101001
J == 01001010   j == 01101010
K == 01001011   k == 01101011
L == 01001100   l == 01101100
M == 01001101   m == 01101101
N == 01001110   n == 01101110
O == 01001111   o == 01101111
P == 01010000   p == 01110000
Q == 01010001   q == 01110001
R == 01010010   r == 01110010
S == 01010011   s == 01110011
T == 01010100   t == 01110100
U == 01010101   u == 01110101
V == 01010110   v == 01110110
W == 01010111   w == 01110111
X == 01011000   x == 01111000
Y == 01011001   y == 01111001
Z == 01011010   z == 01111010


Florian.
_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives, please visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders



Get more from the Web. FREE MSN Explorer download : http://explorer.msn.com

Reply via email to