palindrome c++

string input;

cout << "Please enter a string: ";
cin >> input;

if (input == string(input.rbegin(), input.rend())) {
    cout << input << " is a palindrome";
}

4.33
6

                                    #include&lt;iostream&gt;
#include&lt;string&gt;
#include&lt;algorithm&gt;
bool IsPalindrome_true_false(const std::string&amp; );
int main ()
{
    
    std::cout&lt;&lt;&quot;Please enter a string:\t&quot;;
    std::string str;
    getline(std::cin, str);
    
    // convert the string from uppercase to lowercase 
    int i = 0;
    while(str[i])
    {
        if(str[i] == std::toupper(str[i]) &amp;&amp; std::isalpha(str[i]) == 1024)
        str[i]+= 32;
        ++i;
    }
    // looping while string is empty 
    while(str.empty())
    {
        std::cout&lt;&lt;&quot;\nPlease enter a string your string is empty:\t&quot;;
        if(!str.empty())
        std::string str;
        getline(std::cin, str);
    }
    
    std::cout&lt;&lt;&quot;\n&quot;&lt;&lt;std::boolalpha&lt;&lt;IsPalindrome_true_false(str)&lt;&lt;std::endl;
    std::cout&lt;&lt;std::endl;

    return 0;
}

// check if string is a palindrome and return true or false 
bool IsPalindrome_true_false(const std::string&amp; str)
{

    int i = 0;                
    int j = str.length() - 1; 

    while(i &lt;= j )
    {   
        
        if(std::isalpha(str[i]) == 0){
            ++i;
            continue;
        }else if(std::isalpha(str[j]) == 0){
            --j;
            continue;
        }   
        if(str[i] != str[j]){
        
           return false;
        }
        ++i;
        --j;
    }  
    return true;
}



4.33 (6 Votes)
0
Are there any code examples left?
Create a Free Account
Unlock the power of data and AI by diving into Python, ChatGPT, SQL, Power BI, and beyond.
Sign up
Develop soft skills on BrainApps
Complete the IQ Test
Relative searches
all palindrom substring c++ palindrome number c++ program function to check palindrome in c++ palindrome simple program in string c++ palindrome in string c++ how to check for palindrome in c++ palindrome char check in c++ best way to check for palindrome in cpp how to check if a substring can be a palindrome c++ how to check if a string can be a palindrome c++ palindrome ++ total palindrome word in string cpp c++ palindrin string number palindrome c++ palindrom check cpp palindrome checking in substring in c++ find palindrome string c++ palindrome numbers in c++ string palindrome in c++ geeksforgeeks pallindrome function c++ check string palindrome efficiently c++ palindrome check in c++ palindrome with string parameters c++ chech if string is palindrome c++ pallindrome using c++ check for a string palindrome in c++ c++ program to make string palindrom string pallindrome in c++ palindrome in number c++ palindrome string program in c++ using string functions palindrome sequence of a string cpp check if a string is a palindrome c++ gfg number palindrome or not cpp how to use next palindrome in c++ string The Palindrome Game c++ solution check palindrome array c++ c++ program to check if string is palindrome c++ program for string palindrome without using string function is string a palindrome c++ palindrome. c++ palindrome number in c++ using function palindrome number using c++ palindrome string using function in cpp check palindrome int C++ palindrome keyword in c++ check palindrome function in cpp string is palindrome or not in cpp cpp program to find palindrome the c++palindrome cycle palindrome integer c++ palindrome int c++ check if number is palindrome c++ check which part of a string is palindrome c++ palindromic substring c++ palindrome number patterns c++ check if a number is palindrome in c++ check is palindrome c++ string palindrome program in c++ using for loop palindrome number program in c ++ palindrome checker in c++ most efficient way to find palidrome in string c++ how to check string is palindrome or not in c++ c++ string palindrome in string palindrome c++ string in string c++ string palindrome string palindone c++ string palindone c++6 palindrome string function c++ c++ built in functions for palindrom array palindrome c++ logic of palindrome in c++ check if a string is a palindrome c++ program-to-check-for-palindrome in c++ using stl string is palindrome in c++ range palindrome queries c++ check palindrome string in cpp calculate palindrome number c++ Check a number Palindrome or not in c++ palindrome c++ without using string function string is palindrome c++ palindrome program for cpp hwo to make a string palindrome in c++ c++ pattern programs palindrome of a number check if palindrome c++ fastest way to check palindrome c++ palindrome functio in c_++ check if a string is palindrome c++ cpp program to check palindrome string check palindrome c++ geeks how to check if a number is palindrome in c++ c++ palindrome number program String palindrome program in C++ palindrome c++ string example programming to check palindrome in c++ palindrome function for string c++ how to check a no. is palindrome or not in c++ palindrome stl c++ check for string palindrome c++ stl efficient way to check palindrome c++ check for palindrome c++ stl check for palindrome c++ how to check a string is palindrome or not in c++ string is palindrome check in cpp c++ program to make a string palindrome palindrome c++ program find palindrome in string c++ palindrome cheacker in c++ palindrome string in stl c++ string is palindrome or not in c++ c++ program to check palindrome string c++ string stl palindrome check a palindrome in c++ using function check a palindrome in c++ how to create a palindrome in c++ palindrome c++ efficient see if a string is palindrome c++ check if cpp string is palindrome palindrome of a number c++ palindrome of string in c++ palindrome program check string in c++ palindrome program in c++ function to check palindrome string in c++ palindrome code c++ palindrom in cpp check palindrome string c++ string palindromes c++ how to check palindrome c++ string c++ inbuilt function for palindrome check palindrome in a string c++ function check palindrome in a string c++ check if a string is palindrome in c++ palindromein cpp palindrome of string cpp using stl palindrome of string cpp palindrome check string cpp in c++ write a function of palindrome c++ PROGRAM TO FIND A Palindeome how to check the palindrome in c++ string palindrome c++ make Palindrome c++ palindrome of string c++ palindrome cpp program cpp recursion palindrome valid palindrome IIleetcode solution c++ c++ program to find palindrome finding palindrome in a string c++ palindrome function cpp c++ palindrome using stacck palindrome code in c++ string is palindrome or not c++ palindrome number cpp check for palindrome cpp how to check for palindrome cpp check string palindrome in c++ cpp palindrome string cpp palindrome palindrome string or not in c++ c++ palindrome function strcmp to checkc for palindrome c++ palindrome program in c++ using functions how to find if a given no is palindrome cpp palindrome or not in c++ string palindrome check c++ how to check palindrome c++ check if the string is palindrome cpp is palindrome string c++ how to make a string not palindrome in c++ check palindrome string in c++ check palindrome c++ inclcheck palindrome c++ built in function for palindrome in c++ is palindrome c++ how to check if a number is palindrome c++ palindrome check in cpp find palindrom number in C++ program for palindrome string in c++ check if string is palindrome c++ making a palindrome checker in c++ fonction palindrome c++ palindrome string in cpp how to check palindrome in cpp check palindrome cpp palindrome of a string C++ palindrome of string in cpp is palindrome string cpp palindrome check c++ palindrome function c++ check palindrome in c++ palindrome function in c++ print palindrome string in c++ how to check if given string is palindrome in c++ check string palindrome c++ Palindrome -C ++ Palindrome -C ++ c++ program to print palindrome palindrome algorithm in c++ check for palindrome in c++ palindrome solution in cpp palindrome solution i cpp check palindrome in c++ stl check palindrome in cpp make a string palindrome c++ palindrome of a string in c++ different ways to make a palindrome c++ palindrome in cpp geeksforgeeks c++ program to check palindrome Palindrome Numbers c++ Check if a Given String is Palindrome cpp palindrome from string c++ c++ program for palindrome number c++ program for palindrome find a palindrome number in c++ palindrome cpp c++ program to find palindrome number palindrome command line c++ how to check if string is palindrome in c++ how to check palindrome string in cpp valid palindrome c++ palindrome string program in c++ palindrome in c++ geeksforgeeks c++ palindrome integer How to check if number is palindrome C++ solving palindrome problem in c++ c++ check palindrome number checking palindrome c++ To check whether inputted number is palindrome number or not c++ number is palindrome or not c++ palindrome string in c++ is 26 a palindrome checking palindrome in c++ palindrome in 8086 palindrome c c++ palindrome number how to check a numbe is palindrome c++ c++ code to find if given numbers are palindrome or not palindrome in cpp is palindrome function c++ c++ palindrome palindrome number c++ check palindrome of number c++ palindrome series in c++ palindrome program function c++ palindrome program c++ prime numbers palindrome number and leap year like examples palindrome algorithm c++ string palindrome in cpp string palindrome in c++ c++ palindrome program palindrome string c++ check if int is palindrome c++ palindrome pyramid cpp palindrome c++ string palindrome alp Palindrome number in C++ palindrome in c++ palindrome c++
Made with love
This website uses cookies to make IQCode work for you. By using this site, you agree to our cookie policy

Welcome Back!

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign in
Recover lost password
Or log in with

Create a Free Account

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign up
Or sign up with
By signing up, you agree to the Terms and Conditions and Privacy Policy. You also agree to receive product-related marketing emails from IQCode, which you can unsubscribe from at any time.
Creating a new code example
Code snippet title
Source