Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- #include <iostream>
- using namespace std;
- #include <string>
- //////////////////////////////////////////
- int main()
- {
- string s1 = " TDK ",
- s2 = " SONY ";
- s1 = s1 + s2;
- cout << s1 << endl;
- }
- */
- #include <iostream>
- using namespace std;
- #include <string.h>
- ///////////////////////////////////////////
- struct T
- {
- char sz[99];
- //////////////////////
- char* str_cat(T &r);
- //////////////////
- char* operator +(T &r)
- {
- strcat(sz, r.sz);
- return sz;
- }
- }t1, t2;
- //////////////////////////////////////////
- int main()
- {
- strcpy(t1.sz, " SONY");
- strcpy(t2.sz, " Pictures");
- // t1.str_cat(t2);
- cout << "t1.sz = " << t1.sz << endl;
- cout << " + " << t1 + t2 << endl;
- // cout << "t1.sz = " << t1.sz << endl;
- return 0;
- }
- //////////////////////
- char* T::str_cat(T &r)
- {
- strcat(this->sz, r.sz);
- return sz;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement