C++ program to perform the string operations
kw.cpp
Output
kodingwindow@kw:~$ g++ kw.cpp
kodingwindow@kw:~$ ./a.out ——————————————————————————————————————————— Program for the string operations ——————————————————————————————————————————— String s1 | Hello String s2 | "Hello" String s3 | 'World' ——————————————————————————————————————————— Size of string s2 | 7 Length of string s1 | 5 Length of string s3 | 7 Capacity of string s2 | 15 Concatination s1+s3 | Hello'World' Max size of string s2 | 9223372036854775807 ——————————————————————————————————————————— After swapping the strings... ——————————————————————————————————————————— s3 | "Hello" s2 | 'World' ——————————————————————————————————————————— Insert s3 into s2 | 'Wo"Hello"rld' Delete inserted string| 'World' Replace string AsItIs | "Hello"'World' Append s2 To s3 | "Hello"'World'"Hello" s3 Assign string s2 | "Hello" ——————————————————————————————————————————— kodingwindow@kw:~$
What Next?
C++ Arrays
Advertisement