In this program, You will learn how to copy string using string class in C++.
string str = "Hello";
#include<iostream>
using namespace std;
int main() {
string first;
string second;
cout << "Enter string value:";
getline(cin, first);
second = first;
cout << "Input value is:" << first;
cout << "\nCopy value is:" << second;
return 0;
}
Enter string value:Welcome to xiith
Input value is:Welcome to xiith
Copy value is:Welcome to xiith