Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<string>
- using namespace std;
- int main() {
- string str;
- // Take input string containing spaces
- //getline(cin, str);
- //cout << str << endl;
- string s1 = "A quick brown fox"; // lexical values: 65+32+113+117+105+99+107+32+98+114+111+110+32+102+111+120
- string s2 = " over the lazy dog";
- string s3 = "abcdefgh abcdefgh abcedfgh"; // lexical values: 97+98+99+100+101+102+103+104+32+97+98+99+100+101+102+103+104+3297+98+99+100+101+102+103+104
- //s1.append(s2); // s1 + s2
- //s1.clear(); // will clear the string
- //s3.erase(0, 7);
- //cout << s3 << endl;
- //cout << s1.compare(s3) << endl;
- //cout << s2.find("u");
- //s2.insert(0, "jumps");
- //cout << s2.length() << " " << s2.size() << endl;
- //string s = s2.substr(1, 5);
- //cout << s << endl;
- // Convert a numeric String to Int
- //string numericString = "786";
- //int x = stoi(numericString);
- // Convert a Int to String
- int x = 786;
- string s = to_string(x);
- cout << s << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement