c语言数组的问题!!
#include"stdio.h"
void main()
{char a[20],b[20],c[20],j[20];
int i;
gets (a);
gets (b);
gets (c);
if(strcmp (a,b)>0)
strcpy (j,a);
else
strcpy(j,b);
if(strcmp(c,j)>0)
strcpy(j,c);
printf("%s",j);
}
他怎么老师提示strcmp strcpy 没有定义呀! 不是一开始就定义了四个数组么? 还有strcmp strcpy 这两个函数书上就是这么用的求解释!!
[解决办法]
- C/C++ code
#include"stdio.h"#include "stdlib.h"#include "string.h"void main(){ char a[20],b[20],c[20],j[20]; gets (a); gets (b); gets (c); if(strcmp (a,b)>0) strcpy (j,a); else strcpy(j,b); if(strcmp(c,j)>0) strcpy(j,c); printf("%s\n",j);}//缺少头文件
[解决办法]
[解决办法]
你调用的函数不是你写的,那么你就要把人家的酷加上啊。
如果是你自己写的那就没关系啦。
像上面那些函数,都是string stdlib这些库中,一般平时写的时候,都写上就行了。