c 2b 2b palindrome checker

Solutions on MaxInterview for c 2b 2b palindrome checker by the best coders in the world

showing results for - "c 2b 2b palindrome checker"
Lisa
02 Nov 2019
1#include <iostream>
2using namespace std;
3
4bool isPalindrome(int x) {
5    int rem,reverse=0;
6    while(x!=0){    
7        rem=x%10;      
8        reverse=reverse*10+rem;    
9        x/=10;
10        if (x == reverse) return true;
11        else return false;
12    }
13    return true;
14}
15
16int main() {
17    int n;
18    cin >>n;
19    
20    if(isPalindrome(n)) {
21        cout <<n<<" is a palindrome";
22    }
23    else {
24        cout << n<<" is NOT a palindrome";
25    }
26    return 0;
27}
Irene
08 Oct 2020
1#include<iostream>
2#include<string>
3#include<algorithm>
4bool IsPalindrome_true_false(const std::string& );
5int main ()
6{
7    
8    std::cout<<"Please enter a string:\t";
9    std::string str;
10    getline(std::cin, str);
11    
12    // convert the string from uppercase to lowercase 
13    int i = 0;
14    while(str[i])
15    {
16        if(str[i] == std::toupper(str[i]) && std::isalpha(str[i]) == 1024)
17        str[i]+= 32;
18        ++i;
19    }
20    // looping while string is empty 
21    while(str.empty())
22    {
23        std::cout<<"\nPlease enter a string your string is empty:\t";
24        if(!str.empty())
25        std::string str;
26        getline(std::cin, str);
27    }
28    
29    std::cout<<"\n"<<std::boolalpha<<IsPalindrome_true_false(str)<<std::endl;
30    std::cout<<std::endl;
31
32    return 0;
33}
34
35// check if string is a palindrome and return true or false 
36bool IsPalindrome_true_false(const std::string& str)
37{
38
39    int i = 0;                
40    int j = str.length() - 1; 
41
42    while(i <= j )
43    {   
44        
45        if(std::isalpha(str[i]) == 0){
46            ++i;
47            continue;
48        }else if(std::isalpha(str[j]) == 0){
49            --j;
50            continue;
51        }   
52        if(str[i] != str[j]){
53        
54           return false;
55        }
56        ++i;
57        --j;
58    }  
59    return true;
60}
61
62
63
64
queries leading to this page
string is palindrome or not in cpprange palindrome queries c 2b 2bhow to check the palindrome in c 2b 2bsimple program for palindrome string in c 2b 2bhow to check a string is palindrome or not in c 2b 2bpalindrome program in c 2b 2bhow to check palindrome c 2b 2b stringvalid palindrome iileetcode solution c 2b 2bis palindrome string cpppalindrome sentence algorithm c 2b 2bpalindrome function c 2b 2bmake a string palindrome c 2b 2bcheck palindrome number in c 2b 2bstring palindrome program in c 2b 2bpalindrome simple program in string c 2b 2bc 2b 2b program to make a string palindromecheck if int is palindrome c 2b 2bcheck if palindrome c 2b 2bfonction palindrome c 2b 2bpalindrome string c 2b 2bpalindrome c 2b 2b string in stringpalindrome cheacker in c 2b 2bstring is palindrome or not in c 2b 2bpalindrome string in c 2b 2bpalindrome number program in c 2b 2bstring is palindrome check in cppc 2b 2b palindrome programfunction to check palindrome string in c 2b 2bpalindrome c 2b 2b string examplein c 2b 2b write a function of palindromepalindrome number patterns c 2b 2bcheck if a string is palindrome c 2b 2bhow to check if string is palindrome in c 2b 2bc 2b 2b program to find a palindeomepalindrome in c 2b 2bcheck for palindrome c 2b 2bcpp program to check palindrome stringpalindrome of string cpp using stlfind a palindrome number in c 2b 2bpalindrome functio in c 2b 2bhow to check if given string is palindrome in c 2b 2bpalindrome pyramid cppcheck string palindrome c 2b 2bc 2b 2b pattern programs palindrome of a numbercheck a number palindrome or not in c 2b 2bfind palindrome in string c 2b 2bchech if string is palindrome c 2b 2bcheck which part of a string is palindrome c 2b 2bpalindrome string in cppcheck palindrome in cpphow to check if a number is palindrome c 2b 2bc 2b 2b program to find palindrome numberpalindrome program check string in c 2b 2bpalindrom check cpppalindrome number using string in c 2b 2bpalindrome c 2b 2blogic of palindrome in c 2b 2bpalindrome program for cpppalindrome of string cppprime numbers palindrome number and leap year like examplespalindrome c 2b 2bpalindrome string program in c 2b 2bc 2b 2b string stl palindromeis 26 a palindromec 2b 2b functions palindromefinding palindrome in a string c 2b 2bpalindrome numbers in c 2b 2bpalindrome function for string c 2b 2bpalindrome number program in cpppalindrome code c 2b 2bhow to create a palindrome in c 2b 2bis palindrome string c 2b 2bpalindrome in number c 2b 2bc 2b 2b inbuilt function for palindromec 2b 2b palindrome numberpalindrome series in c 2b 2bcheck palindrome in c 2b 2b stlefficient way to check palindrome c 2b 2bc 2b 2b palindromepalindrome cpp programstack palindrome number c 2b 2b 5cpalindrome of string c 2b 2bpalindrome keyword in c 2b 2bcheck palindrome c 2b 2bbest way to check for palindrome in cpppalindrome checker c 2b 2bchecking palindrome in c 2b 2bpalindrome cc 2b 2b program to print palindromepalindrome program in c 2b 2b using string functionspalindrome program function c 2b 2bstring palindrome check c 2b 2binclcheck palindrome c 2b 2bstring is palindrome c 2b 2bc 2b 2b check if number is palindromeis palindrome function c 2b 2bcheck palindrome in a string c 2b 2b functionpalindrome of a string in c 2b 2bpalindrome numbers c 2b 2bcpp code for palindrome numberpalindrome in 8086string is palindrome or not c 2b 2bsolving palindrome problem in c 2b 2bpalindrom in cpppalindrone no cppc 2b 2b palindrome number programcheck palindrome in c 2b 2bcheck string palindrome in c 2b 2bpalindrome array in c 2b 2bpalindrome c 2b 2b efficientc 2b 2b program to check palindromearray palindrome c 2b 2bcheck for string palindrome c 2b 2b stl palindrome check c 2b 2bpalindrome string in stl c 2b 2bdifferent ways to make a palindrome c 2b 2bpalindrome checker in c 2b 2bc 2b 2b program for palindrome numberhow to check palindrome in c 2b 2bhow to check if number is palindrome c 2b 2bpalindrome from string c 2b 2bcheck palindrome c 2b 2b geekshow to check palindrome in cppcheck palindrome cppprogram for palindrome in c 2b 2bpalindrome c 2b 2b stringcheck palindrome int c 2b 2bcpp program to check palindromec 2b 2b palindrome checkerc 2b 2b code to find if given numbers are palindrome or notcpp code for palindrome number simplestring palindromes c 2b 2bc 2b 2b palindrome using stacckc 2b 2b palindrome functionhow to make a string not palindrome in c 2b 2bpalindrome or not in c 2b 2bc 2b 2b program to check palindrome stringcpp recursion palindromehow to find if a given no is palindrome cpppalindrome number in c 2b 2bhow to check if a number is palindrome in c 2b 2bmake palindrome c 2b 2bstrcmp to checkc for palindrome c 2b 2bprogramming to check palindrome in c 2b 2bhwo to make a string palindrome in c 2b 2bpalindrome string or not in c 2b 2bcpp palindromecheck if string is palindrome c 2b 2bc 2b 2b built in functions for palindromcheck palindrome function in cpphow to check for palindrome cpppalindrome of string in c 2b 2bpallindrome function c 2b 2bpalindrome number in c 2b 2b using functionpalindrome command line c 2b 2bbuilt in function for palindrome in c 2b 2bhow to check if a string is palindrome in c 2b 2bpalindrome of a number c 2b 2bpalindrome solution in cpppalindrome solution i cppc 2b 2b program to find palindromecheck a palindrome in c 2b 2bcheck palindrome in a string c 2b 2bc 2b 2b string palindromepalindrome check in cpppalindrome in c 2b 2b geeksforgeekscheck palindrome string c 2b 2bcheck palindrome array c 2b 2bhow to check whether the number is palindrome or not c 2b 2bto find palindron c 2b 2bmake a string a palindrome c 2b 2bpalindromein cpppalindrome number using c 2b 2bcheck if a string is a palindrome c 2b 2bfind palindrom number in c 2b 2bpalindrome function cppstring palindrome in c 2b 2bpalindrome code in c 2b 2bpalindrome in cpppalindrome c 2b 2b programhow to check palindrome c 2b 2bcheck if the string is palindrome cppthe palindrome game c 2b 2b solutionstring is palindrome in c 2b 2bprogram for palindrome string in c 2b 2bchecking palindrome c 2b 2bpalindrome in string c 2b 2bthe c 2b 2bpalindrome cyclefind whether the given number is palindrome or not in c 2b 2bfunction to check palindrome in c 2b 2bcpp program to find palindromepalindrome array c 2b 2bpalindrome n c 2b 2bnumber is palindrome or not c 2b 2bcheck if cpp string is palindromepalindrome algorithm c 2b 2bprint palindrome string in c 2b 2bpalindrome stl c 2b 2bmaking a palindrome checker in c 2b 2bpalindrome function in c 2b 2bhow to check if number is palindrome in c 2b 2bpalindrome with string parameters c 2b 2bcheck for palindrome in c 2b 2bcheck a palindrome in c 2b 2b using functionto check whether inputted number is palindrome number or not c 2b 2bcheck for palindrome c 2b 2b stlcheck if a given string is palindrome cpphow to check if a number is a palindrome in c 2b 2bis palindrome c 2b 2bstring palindrome in cpppalindrome int c 2b 2bpalindrome c 2b 2bhow to check palindrome string in cppc 2b 2b palindrome integersee if a string is palindrome c 2b 2bc 2b 2b program for palindromefastest way to check palindrome c 2b 2bcpp palindrome stringpalindrome program in c 2b 2b using functionspalindrome of string in cppcheck if number is palindrome c 2b 2bpalindrome number cppcheck palindrome of number c 2b 2bpalindrome of a string c 2b 2bpalindrome check string cpppalindrome cppcheck palindrome string in cppstring palindrome c 2b 2bvalid palindrome c 2b 2bpalindrome number c 2b 2bcheck for palindrome cpphow to check a numbe is palindrome c 2b 2bcheck if a number is palindrome c 2b 2bcheck if a string is palindrome in c 2b 2bpallindrome using c 2b 2bpalindrome algorithm in c 2b 2bpalindrome alppalindrome in cpp geeksforgeeks palindrome c 2b 2bcheck string palindrome in cppc 2b 2b check palindrome numberhow to get palimdrome in c 2b 2bc 2b 2b program to make string palindromhow to check a no is palindrome or not in c 2b 2bcpp program to check a number is palindromecheck palindrome string in c 2b 2bpalindrome program c 2b 2bc 2b 2b palindrome checker