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