How to append part of string to another string in C++

1 Answer

0 votes
#include <iostream>
 
using namespace std;
 
int main() {
    string s1 = "c++"; 
    string s2 = "java python"; 

    s1.append(s2, 2, 6); 
  
    cout << s1;
}
 
 
 
/*
run:
 
c++ java
 
*/

 



answered Jan 9, 2020 by avibootz

Related questions

1 answer 189 views
1 answer 220 views
1 answer 191 views
1 answer 200 views
2 answers 190 views
1 answer 124 views
1 answer 115 views
...