#include <iostream> #include<string> using namespace std; int main() { string str1 = "aimtocodeer is for Prayag"; string str2 = "aimtocode rocks"; char ch[80]; str1.copy(ch,13,0); cout << "The new copied character array is : "; cout << ch << endl << endl; cout << "The 1st string before swapping is : "; cout << str1 << endl; cout << "The 2nd string before swapping is : "; cout << str2 << endl; str1.swap(str2); cout << "The 1st string after swapping is : "; cout << str1 << endl; cout << "The 2nd string after swapping is : "; cout << str2 << endl; return 0; }