2017-03-24 21:53:41 +01:00
|
|
|
#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';
|
|
|
|
}
|