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 266 views
1 answer 346 views
1 answer 307 views
1 answer 303 views
2 answers 332 views
1 answer 215 views
...