Skip to content
Snippets Groups Projects
main.cpp 637 B
Newer Older
  • Learn to ignore specific revisions
  • Pelotrio's avatar
    Pelotrio committed
    #include <iostream>
    #include <algorithm>
    #include "sort.h"
    
    using namespace std;
    
    bool isPalindrome();
    
    string input;
    
    int main() {
    
        bool palindrome = isPalindrome();
        cout << "Das Wort ist ein Palindrome: " << boolalpha << palindrome << endl;
    
        string sorted = sortString(input);
        cout << "Das Wort aufsteigend sortiert: " << sorted << endl;
    
        return 0;
    }
    
    bool isPalindrome() {
        cout << "Bitte geben Sie ein Wort ein:";
        cin >> input;
        transform(input.begin(), input.end(), input.begin(), ::tolower);
    
        string reversed = input;
        reverse(reversed.begin(), reversed.end());
        return reversed == input;
    }