You are viewing a single comment's thread. Return to all comments →
This is an alternative,without using swap function.
#include <iostream> #include <string> using namespace std; int main() { int t; string s1,s2; cin>>s1>>s2; cout<<s1.size()<<" "<<s2.size()<<endl; cout<<s1+s2<<endl; t=s1[0]; s1[0]=s2[0]; s2[0]=t; cout<<s1<<" "<<s2; return 0; }
Seems like cookies are disabled on this browser, please enable them to open this website
Strings
You are viewing a single comment's thread. Return to all comments →
This is an alternative,without using swap function.