Code works, however i'm having problems with reverse string- i cant figure out how to index the elements. for cycle returns errors, what else could i use?
The end goal would be to compare string line with string reverse. If adequate elements match its a palindrome.
#include <iostream>
#include <string>
using namespace std;
int main()
{
string line;
cout<< "sentence: \n";
getline (cin, line);
cout<< "in reverse: \n";
string::reverse_iterator reverse;
for (reverse=line.rbegin(); reverse<line.rend(); reverse++)
cout<< *reverse;
return 0;
}