###Pass by const reference to avoid a copy.
Pass by const reference to avoid a copy.
Not sure this is true.
if (PossiblePalindrome.size() < 3)
{
Palidrime = false;
}
###Not sure this is true. if (PossiblePalindrome.size() < 3) { Palidrime = false; } UnlessUnless they gave you special instructions. A zero and one length string is a palindrome.
###Use auto when you can
Use auto when you can
Sure you can go full out and specify the types. But in modern C++ we usallyusually like the compiler to deduce the types (especially if the exact type is not important. For: for iterators the exact type is not important, just the fact that it is in the group of types that implement an iterator).
###Prefer to use pre-increment.
Prefer to use pre-increment.
It makes very littellittle difference in this context (so I am not bashing you for this exact usage). But it does make a tiny difference and if used in the wrong place can cause a difference.
###Why not use a break in the loop.
Why not use a break in the loop?
###Be consistent with braces.
Be consistent with braces.
Notice that the operator>> only readreads a single space separated word.
If you ignore space and capatolizationcapitalization the above is an palindrome. You could have used std::getline() to read a line of text from the user.
###Use ternary operator (judicially)
Use ternary operator (judicially)
###Prefer '\n' over std::endl
Prefer '\n' over std::endl
The only difference here is a flush of the buffer.
Manually flushing the buffer is actually the major cause of slow down in C++ ioi/o based code. The system libraries are practically optimal in the timing for flush and any attempt by you will just usually screw things up.