append string c 2b 2b

Solutions on MaxInterview for append string c 2b 2b by the best coders in the world

showing results for - "append string c 2b 2b"
Magdalena
02 Jul 2020
1// appending to string
2#include <iostream>
3#include <string>
4
5int main ()
6{
7  std::string str;
8  std::string str2="Writing ";
9  std::string str3="print 10 and then 5 more";
10
11  // used in the same order as described above:
12  str.append(str2);                       // "Writing "
13  str.append(str3,6,3);                   // "10 "
14  str.append("dots are cool",5);          // "dots "
15  str.append("here: ");                   // "here: "
16  str.append(10u,'.');                    // ".........."
17  str.append(str3.begin()+8,str3.end());  // " and then 5 more"
18  str.append<int>(5,0x2E);                // "....."
19
20  std::cout << str << '\n';
21  return 0;
22}