Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<string>
- using std::cin;
- using std::cout;
- using std::string;
- void capitalize_letters(string & a);
- void main() {
- string a;
- cout << "Please enter a Word \n";
- cin >> a;
- std::getline(cin, a);
- capitalize_letters(a);
- cout << a;
- bool is_palindrome(true);
- for (size_t i(0); is_palindrome && i < a.size() / 2; ++i) {
- if (a[i] != a[a.size() - i - 1]) {
- is_palindrome = false;
- break;
- }
- }
- if (is_palindrome) {
- cout << "This is a palindrome \n";
- }
- else {
- cout << "This is not a palindrome \n";
- }
- }
- void capitalize_letters(string & a) {
- for (size_t i(0); i < a.size(); ++i) {
- a[i] = toupper(a [i]);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement