一、要求
提示输入一个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码值并打印对应的字符。通过使用printf()函数进行类型强制转换实现。
1271

被折叠的 条评论
为什么被折叠?



