文档分类
void main() {
}
c=getchar(); //也可用scanf("%c",&c); if(c>='0'&&c<='9') { n=c-'0'+10; //'5'是字符,5是整数,则'5'-'0'得整数5, //即数字字符c-'0'得出相应的整数 printf("%d",n); char c; int n; } //注意,别忘了加{ }