编程从键盘输入一个小写英文字母,将其转换为大写英文字母后,将转换后的大写英文字母及其十进制的ASCII码值显示到屏幕上。
输入提示信息:"Press a key and then press Enter:"
输入字符用getchar()
输出提示信息和格式:"%c, %d\n"
程序运行示例:
Press a key and then press Enter:d
D, 68
#include<stdio.h>
int main()
{
Char ch;
printf("Press a key and then press Enter:");
ch=getchar();
ch=ch-32;
printf("%c,%d\n",ch,ch);
return 0;
}
因篇幅问题不能全部显示,请点此查看更多更全内容