C语言程序:
#include
void main()
{
char ch = 'G';
int value = 'G';
橡冲睁 printf("input a character : ");
ch = getchar();
value = ch;
getchar();
if(ch >= 'a' && ch <= 'z')
判腊 ch -= 32;
printf("%c %d\n", ch, value);
printf("input a character : ");
scanf("%c", &ch);
value = ch;
if(ch >= 'a' && ch <= 'z')
ch -= 32;
printf("%c %d\n", ch, value);
}
运行测试: