425
In this example we show you how to copy one string to another in C++
Example
#include <iostream> using namespace std; int main() { string myString1, myString2; cout << "Enter string 1: "; getline (cin, myString1); myString2 = myString1; cout << "string 1 = "<< myString1 << endl; cout << "string 2 = "<< myString2; return 0; }
When you run this you will see something like this
Enter string 1: maxprogramming string 1 = maxprogramming string 2 = maxprogramming -------------------------------- Process exited after 6.34 seconds with return value 0 Press any key to continue . . .