Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main() {
- char ch1 = 'A';
- char ch2 = 'Z';
- cout << ch1 << ' ' << ch2 << '\n';
- cout << (int)ch1 << ' ' << (int)ch2 << '\n';
- cout << ch2 - ch1 << '\n';
- char x = '9';
- int y = x - '0';
- cout << y << '\n';
- string s = "yes";
- cout << s[0] << ' ' << s[1] << ' ' << s[2] << '\n';
- s[1] = 'o';
- cout << s << '\n';
- for (int i = 0; i < s.length(); ++i) {
- s[i] = 'a';
- }
- cout << s << '\n';
- string t;
- cout << t << '\n';
- string s1 = "ab";
- string s2 = "cd";
- cout << s1 + s2 << '\n'; // Конкатенация строк.
- s1 += s2;
- cout << s1 << '\n'; // abcd
- cout << s1.substr(2, 2) << '\n';
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement