|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
#include <stdio.h>
int main ()
{
char a;
scanf("%c",&a); //输入一个字母
a = (a >= 'A' && a <= 'Z') ?(a+ 32):a; //判断字母是大写还是小写,大写的就转换为小写输出。
printf("%c\n",a); //将判断后的结果输出。
return 0;
}
~
[tongxin@localhost sle19]$ gcc text.c
text.c: 在函数‘main’中:
text.c:6:2: 错误:程序中有游离的‘\357’
a = (a >= 'A' && a <= 'Z') ?(a+ 32):a; //判断字母是大写还是小写,大写的就转换为小写输出。
^
text.c:6:2: 错误:程序中有游离的‘\274’
text.c:6:2: 错误:程序中有游离的‘\237’
text.c:6:32: 错误:called object is not a function or function pointer
a = (a >= 'A' && a <= 'Z') ?(a+ 32):a; //判断字母是大写还是小写,大写的就转换为小写输出。
^
text.c:6:39: 错误:expected ‘;’ before ‘:’ token
a = (a >= 'A' && a <= 'Z') ?(a+ 32):a; //判断字母是大写还是小写,大写的就转换为小写输出。
^
- #include <stdio.h>
- int main ()
- {
- char a;
- scanf("%c",&a); //输入一个字母
- a = (a >= 'A' && a <= 'Z') ? (a+ 32):a; //判断字母是大写还是小写,大写的就转换为小写输出。 这里错了,用了中文问号
- printf("%c\n",a); //将判断后的结果输出。
- return 0;
- }
复制代码
|
|