Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ConsoleApplication2.cpp: определяет точку входа для консольного приложения.
- //
- #include "stdafx.h"
- #include <string>
- #include "iostream"
- using namespace std;
- int main()
- {
- string s1;
- string s2("ABC");
- string s3("ABCDF");
- string s4(s2);
- cout << s2 << endl;
- cout << s3 << endl;
- cout << s4 << endl;
- s1 = "GFFF";
- s2 = 'x';
- s3 = "123456";
- s4 = s3;
- cout << s1 << endl;
- cout << s2 << endl;
- cout << s3 << endl;
- cout << s4 << endl;
- cin >> s1;
- getline(cin, s1);
- cout << s1<<endl;
- cin.get();
- cout << "vvedite text" << endl;
- getline(cin, s2);
- cout << s1 << endl;
- cout << s2 << endl;
- s1 = "what?";
- s2 = "where?";
- s3 = "when?\n";
- string s5 = s1 + s2 + s3;
- s5 += s3;
- cout << s5 << endl;
- s1 = "abc";
- s2 = "bcd";
- cout<<(s1 == s2) << endl;
- s2 = "kqwefpok";
- cout << (s1 < s2) << endl;
- s2 = "acc";
- cout << ("abc" < "acc") << endl;
- cout << "dlina s5=" << s5.size() << endl;
- cout << s5.max_size() << endl;
- cout << s5.capacity() << endl;
- for (int i = 0; i < s5.size(); i++)
- {
- cout << s5;
- }
- string s7;
- cout << s7.capacity() << endl;
- s5.erase(4, 4);
- cout << s5 << endl;
- cout << s5.size() << endl;
- s5.erase(10, 6);
- cout << s5 << endl;
- s5.insert(4, "where?");
- cout << s5 << endl;
- s5.push_back('!');
- cout << s5 << endl;
- s5.erase();
- cout << s5 << endl;
- if (s5.empty())
- {
- cout << "pusto\n";
- }
- else {
- cout << "ne gusto\n";
- }
- cout << s5.max_size() << endl;
- for (char ch = 'a'; ch <= 'z'; ++ch)
- s5.push_back(ch);
- string::size_type indx;
- s5 = "WHEEEEEEEEN?";
- s5 = s5 + s3;
- cout << s5 << endl;
- cout << s5 << endl;
- indx = s5.find(s3);
- cout << s5.find("AAA");
- cout << indx << endl;
- s5 = "123,45";
- string::size_type kod;
- double xx = stod(s5, &kod);
- if (s5.size() == kod)
- cout << kod << endl;
- else
- cout << "Error" << endl;
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement