How to append string to another string in C++

1 Answer

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

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

 



answered Jan 9, 2020 by avibootz

Related questions

1 answer 296 views
2 answers 332 views
1 answer 215 views
1 answer 194 views
1 answer 244 views
1 answer 243 views
4 answers 386 views
...