Start code: session3-start.tar.gz
$ tar xzvf session3-start.tar.gz
Inspect, compile and run the program
Check that it works on simple example.
Copy it as a second version
palindrome_sentence.cxx and modify it that will not check word palindrome, but sentence palindrome itself: such as
std::getline() function to read the whole input sentence
In order to be able to use the given function (
IsPalindrom), reduce the
sentence to a word: remove all non alphabetical characters: spaces, punctuation, etc.
Comparing strings and characters is case sensitive (a != A);
can be used to change all letters in the sentence to lower case
#include <string> char letter1 = 'A'; char letter2 = tolower(letter1);