C语言编程:从键盘输入2个字符,分别显示字符对应的ASCII码十进制值、十六进制值,以及字符变量的地址。

急求大神解答下啊

第1个回答  2013-03-08
#include<stdio.h>
#include <windows.h>
#include <stdlib.h>

int main(void)
{
char a, b;
scanf("%c %c", &a, &b);
printf("%d\t %d\n", a, b);
printf("0x%x\t 0x%x\n", a, b);
printf("0x%p\t 0x%p\n", &a, &b);
system("pause");
return 0;
}来自:求助得到的回答
第1个回答  2013-03-08
输入一个字符 马上打印出十进制 十六禁止 以及地址 当输入1 结束程序。
#include <stdio.h>
int main()
{
char c;
system("stty raw");
while((c = getchar())!= '1')

printf("%d , 0x%x , %x \n",c,c,&c);

system("stty cooked");

return 0;

}本回答被提问者和网友采纳