Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- string s = "ab";
- s[0] = '1';
- s[1] = '2';
- cout << s << "." << s[0] << "." << s[1] << "." << endl;
- string ss = "";
- ss[0] = '1';
- ss[1] = '2';
- cout << ss << "." << ss[0] << "." << ss[1] << "." << endl;
- string ss = "";
- ss[0] = '1';
- ss[1] = '2';
- cout << ss << "." << ss[0] << "." << ss[1] << "." << endl;
- string ss = "";
- ss.at(0) = '1';
- ss.at(1) = '2';
- cout << ss << "." << ss[0] << "." << ss[1] << "." << endl;
- $ ./cxx-test.exe
- libc++abi.dylib: terminate called throwing an exception
- Abort trap: 6
- string ss = " "; // two blanks spaces
- string ss;
- ss.resize(2);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement