I am trying to make a palindrome checker. So in order to tackle this problem I figured I would compare the original string to the reversed one. However how can I save the reversed string without overwriting the old one?
reverse(myString.begin(), myString.end())
will reverse my string but it replaces myString and doing string reversedString = reverse(myString.begin(), myString.end());
does not work. Here is what I have so far:
int main()
{
cout << "Enter a string: ";
string myString;
getline(cin, myString);
cout << endl;
string reversedString = reverse(myString.begin(), myString.end());
cout << reversedString;
return 0;
}