判断字符型变量c1是否为数字字符的正确表达式为
A: '0'<=c1<='9'
B: ('9'>=c1)&&('0'<=c1)
C: (c1<='9')||(c1>='0')
D: (c1>='9')&&(c1<='0')
A: '0'<=c1<='9'
B: ('9'>=c1)&&('0'<=c1)
C: (c1<='9')||(c1>='0')
D: (c1>='9')&&(c1<='0')
举一反三
- 判断字符型变量c1是否为数字字符的正确表达式为 A: '0'<;=c1<;='9' B: ('9'>;=c1)&&('0'<;=c1) C: (c1<;='9')||(c1>;='0') D: (c1>;='9')&&(c1<;='0')
- 判断char类型的变量c1是否为数字字符的正确表达式为( )。 A: (c1>=0)&&(c1<=9) B: (c1>=’0’)&&(c1<=’9’) C: ‘0’<=c1<=’9’ D: (c1>=’0’)||(c1<=’9’)
- 判断char类型的变量c1是否为数字字符的正确表达式为 ( ) A: (c1>;=0)&&(c1<;=9) B: (c1>;= '0 ')&&(c1<;= '9') C: '0'<;=c1<;= '9 ' D: (c1>;= '0 ')||(c1<;= '9 '
- 判断字符型变量c1是否为数字字符的正确表达式为 A: '0'<=c1<='9' B: ('9'>=c1)&&('0'<=c1) C: (c1<='9')||(c1>='0') D: (c1>='9')&&(c1<='0')
- 下列给定程序中,函数fun的功能是进行数字字符转换。若形参ch中是数字字符'0'~'9',则将'0'转换成'9','1'转换成'8','2'转换成'7',……,'9'转换成'0';若是其他字符则保持不变;并将转换后的结果作为函数值返回。 #include 请填空(1) fun(char ch) { if (ch>='0' &&请填空(2) ) return '9'- (ch- 请填空(3) ) ; return ch ; } main() { char c1, c2; printf("\nThe result :\n"); c1='2'; c2 = fun(c1); printf("c1=%cc2=%c\n", c1, c2); c1='8'; c2 = fun(c1); printf("c1=%cc2=%c\n", c1, c2);c1='a';c2 = fun(c1); printf("c1=%cc2=%c\n", c1, c2); }