一、要求
提示输入一个ASCII码值(如,66),然后打印输入的字符。
二、程序
使用printf()函数进行强制转换。
#include <stdio.h>
int main()
{
int ascii;
printf("Enter an ASCII code:");
scanf("%d",&ascii);
printf("%d is the ASCII code for %c.\n",ascii,ascii);//printf()函数类型强制转换
return 0;
}
三、结果
更多推荐
【C语言学习笔记(一)】ASCII码转字符
发布评论