New
This commit is contained in:
52
STL/STL-String/string.cpp
Normal file
52
STL/STL-String/string.cpp
Normal file
@@ -0,0 +1,52 @@
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
using namespace std;
|
||||
int main(){
|
||||
string a;
|
||||
a = "Good Game!";
|
||||
cout << a << endl;
|
||||
string::iterator it = a.begin();
|
||||
a.insert(5, "Fucking ");
|
||||
cout << a << endl;
|
||||
cout << a.length() << endl;
|
||||
cout << a.front() << " " << a.back() << endl;
|
||||
a.erase(0, 5);
|
||||
cout << a << endl;
|
||||
a.append(" That is good!");
|
||||
a += "test";
|
||||
cout << a << endl;
|
||||
a.pop_back();a.pop_back();
|
||||
cout << a << endl;
|
||||
a.pop_back();a.pop_back();
|
||||
cout << a << endl;
|
||||
a.replace(8, 12, "Gay");
|
||||
cout << a << endl;
|
||||
cout << a.find("Gays") << endl;
|
||||
string b = a.substr(8, 3);
|
||||
cout << b << endl;
|
||||
b.insert(2, 2, 'H');
|
||||
cout << b << endl;
|
||||
int i = std::stoi("123");
|
||||
double d = std::stod("3.14");
|
||||
string s = std::to_string(42);
|
||||
cout << s << " " ;
|
||||
s.append("Orz");
|
||||
cout << s << endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
Good Game!
|
||||
Good Fucking Game!
|
||||
18
|
||||
G !
|
||||
Fucking Game!
|
||||
Fucking Game! That is good!test
|
||||
Fucking Game! That is good!te
|
||||
Fucking Game! That is good!
|
||||
Fucking Gays good!
|
||||
8
|
||||
Gay
|
||||
GaHHy
|
||||
42 42Orz
|
||||
*/
|
Reference in New Issue
Block a user