File tree Expand file tree Collapse file tree 4 files changed +47
-2
lines changed Expand file tree Collapse file tree 4 files changed +47
-2
lines changed Original file line number Diff line number Diff line change 1+ #include < iostream>
2+ #include < string>
3+ using namespace std ;
4+ int main ()
5+ {
6+ string str;
7+ cout << " Enter any string" <<endl;
8+ getline (cin,str);
9+ cout << " Entered String: " << str << endl;
10+
11+ if (str==" hello world" )
12+ {
13+ cout << " It is equal to hello world" << endl;
14+ }
15+ else
16+ {
17+ cout << " It is not equal to hello world" << endl;
18+ }
19+
20+ cout << " String length: " <<str.length () << endl;
21+ cout << " String with append: " << str.append (" hello" ) << endl;
22+
23+ str.push_back (' a' );
24+ cout << str << endl;
25+ str.pop_back ();
26+ cout << str << endl;
27+
28+ cout << " CAPACITY: " << str.capacity () << endl;
29+
30+ string str1=" anonymous" ;
31+ cout << " str: " << str << endl;
32+ cout << " str1: " << str1 << endl<<endl;
33+
34+ str.swap (str1);
35+ cout << " After swapping function" << endl;
36+ cout << " str: " << str << endl;
37+ cout << " str1: " <<str1 << endl;
38+ }
Original file line number Diff line number Diff line change 2222
2323#### STRING
2424
25+ * [ Strings] ( Data-Structures/STRING/Strings.cpp )
26+
2527#### LISTS
2628
2729* SINGLE
Original file line number Diff line number Diff line change @@ -89,6 +89,7 @@ Indexer for Data Structures Lover
8989* docs
9090* implementation
9191 * [ C] ( C/Data-Structures/STRING/String.c )
92+ * [ C++] ( C++/Data-Structures/STRING/Strings.cpp )
9293 * [ JAVA] ( Java/Data-Structures/STRING/Strings.java )
9394* complexity
9495
Original file line number Diff line number Diff line change @@ -65,8 +65,8 @@ This page contains the complexities of different algorithms in this repository.
6565 * [ HEAPED 3D ARRAY] ( #dynamic-3d-arrays-(CC++) )
6666 * [ JAGGED ARRAY] ( #jagged-array )
6767 * [ STRING] ( #string )
68- * [ Strings in C]
69- * [ Strings in C++]
68+ * [ Strings in C] ( #strings-in-c )
69+ * [ Strings in C++] ( #strings-in-cpp )
7070 * [ Strings in JAVA] ( #strings-in-java )
7171 * [ LISTS] ( #lists )
7272 * SINGLE
@@ -333,6 +333,10 @@ This page contains the complexities of different algorithms in this repository.
333333
334334### STRING
335335
336+ #### Strings in C
337+
338+ #### Strings in CPP
339+
336340#### Strings in JAVA
337341
338342SNo. | Methods | Order of complexity O(n) | Type of Complexity
You can’t perform that action at this time.
0 commit comments