示例
#include<stdio.h> #include<iostream> #include<cstring>//<string.h>是不包括strlen的,要使用cstring using namespace std; char st[]="hello!"; int main(){ int l=strlen(st); st[l]='w'; for(int i=0;i<l;i++){ cout<<st[i]; } return 0; }
讯享网
经典问题----strlen was not declared in thos scope示例 include stdio h include iostream include cstring string h 是不包括 strlen 的 要使用 cstring using namespace std char st hello string h cstring iostream stdio h
#include<stdio.h> #include<iostream> #include<cstring>//<string.h>是不包括strlen的,要使用cstring using namespace std; char st[]="hello!"; int main(){ int l=strlen(st); st[l]='w'; for(int i=0;i<l;i++){ cout<<st[i]; } return 0; }
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容,请联系我们,一经查实,本站将立刻删除。
如需转载请保留出处:https://51itzy.com/kjqy/33875.html