大家好,我是个自学新手。请问我下面这段代码哪里错了?明明和书上的一样啊!
河伯的新娘 2019-12-10 07:05:21 #include<stdio.h>
#include<string.h>
int main()
{
char a[30],b[30];
int c;
int i=0;
while(1)
{
printf("请选择:0表示小写字母转大写字母,1表示大写字母转小写字母,2表示退出。\n");
scanf("%d",&c);
if(c==0)
{
printf("请输入需要转换的字母。\n");
scanf("%s",&a);
strcpy(b,a);
strupr(b);
printf("转换后的字母为%s\n",b);
}
else if(c==1)
{
printf("请输入需要转换的字母。\n");
scanf("%s",&a);
strcpy(b,a);
strlpr(b);
printf("转换后的字母为%s\n",b);
}
else if(c==2)
{
break;
}
}
return 0;
运行的时候手机显示:
/data/user/0/coding.yu. ccompiler. new/
files/gcc/tmpdir/ccmKpCLm.: In function
'main':
default.: ( text+0x58): undefined reference
to strupr
default.c: ( text+0xa4): undefined reference
to strlpr'
collect2: error: ld returned 1 exit status