题目:
从键盘输入一个字符,按规定格式输出这个字符及它的ASCII
码。例如:
测试输入: A
预期输出: “The ASCII of 'A' is 65”.
测试输入: a
预期输出: “The ASCII of 'a' is 97”.
代码如下:
#include <stdio.h>
int main()
{
char a;
scanf("%c",&a);
printf("\"The ASCII of '%c' is %d\".",a,(int)a );
return 0;
}
运行结果如下:
A
"The ASCII of 'A' is 65".
--------------------------------
Process exited after 2.147 seconds with return value 0
请按任意键继续. . .
a
"The ASCII of 'a' is 97".
--------------------------------
Process exited after 3.592 seconds with return value 0
请按任意键继续. . .