64,682
社区成员
发帖
与我相关
我的任务
分享
#include<iostream>
char* Strcpy(char* d,const char* s)
{
while ((*d++ = *s++) != '\0')
;
return d;
}
int main()
{
using namespace std;
char* d =new char[20] ;
char s[20] = "Hello world!";
char* e=new char[20];
Strcpy(e,Strcpy(d,s));
cout << d << endl;
cout << e << endl;
return 0;
}
#include<iostream>
char* Strcpy(char* d,const char* s)
{
while ((*d++ = *s++) != '\0')
;
return d;
}
int main()
{
using namespace std;
char* d =new char[20] ;
char s[20] = "Hello world!";
char* e = new char[20];
Strcpy(d, s);
Strcpy(e,d);
cout << d << endl;
cout << e << endl;
return 0;
}
#include<iostream>
char* Strcpy(char* d,const char* s)
{
while ((*d++ = *s++) != '\0')
;
return d;
}
int main()
{
using namespace std;
char* d =new char[20] ;
char s[20] = "Hello world!";
char* e = new char[20];
Strcpy(d, s);
Strcpy(e,d);
cout << d << endl;
cout << e << endl;
return 0;
}
char* Strcpy(char* dst, const char* src)
{
assert(dst != s);
char *p = dst;
while ((*p++ = *s++) != '\0')
;
*p = '\0';
return dst;
}
#include<iostream>
char* Strcpy(char* d,const char* s)
{
char* t = d;
while ((*t++ = *s++) != '\0')
;
return d;
}
int main()
{
using namespace std;
char* d =new char[20] ;
char s[20] = "Hello world!";
char* e = new char[20];
Strcpy(e,Strcpy(d, s));
cout << d << endl;
cout << e << endl;
return 0;
}