27 lines
481 B
C
27 lines
481 B
C
#include <stdio.h>
|
|
#include <conio.h>
|
|
void CharToString(char,char*);
|
|
unsigned int toAscii(char);
|
|
int main()
|
|
{
|
|
char cara,b[9];
|
|
for(cara='A'; cara<='Z';cara++)
|
|
{
|
|
CharToString(cara,b);
|
|
printf("%c: %Xh %s\n",cara, toAscii(cara), b);
|
|
}
|
|
getch();
|
|
return 0;
|
|
}
|
|
|
|
unsigned int toAscii(char c)
|
|
return (unsigned int)c;
|
|
|
|
void CharToString(char cara, char* b)
|
|
{
|
|
int i;
|
|
for(i=0;i<8;i++)
|
|
b[8-i-1]=(cara&(1<<i))?'1':'0';
|
|
b[8]='\0';
|
|
}
|