palindrome c 2b 2b

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

showing results for - "palindrome c 2b 2b"
Marc
28 Feb 2017
1string input;
2
3cout << "Please enter a string: ";
4cin >> input;
5
6if (input == string(input.rbegin(), input.rend())) {
7    cout << input << " is a palindrome";
8}
9
Bruno
08 Oct 2018
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}
Eduardo
05 May 2016
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
c 2b 2b string stl palindromecheck if a given string is palindrome cppc 2b 2b palindrome numberhow to check for palindrome cpppalindrome checking in substring in c 2b 2bc 2b 2b program to make a string palindromeprogram to check palindrome string c 2b 2bc 2b 2b palindrin stringpalindrome c 2b 2b programhow to check palindrome c 2b 2bcpp palindrome stringcode to figure out whether a string is a palindrome c 2b 2bmake a string a palindrome c 2b 2btotal palindrome word in string cppc 2b 2b palindrome number programpalindrome logic in cpphow to check if number is palindrome c 2b 2bc 2b 2b program for string palindrome without using string functionpalindrome check string cppcheck string palindrome c 2b 2bpalindrome program in c 2b 2b using functionspalindrome in cpp geeksforgeeksprogramming to check palindrome in c 2b 2bcheck for string palindrome c 2b 2b stl palindrome pyramid cppcheck for palindrome c 2b 2bpalindrom check cppcheck palindrome string in c 2b 2bfunction to check palindrome in c 2b 2bcheck string palindrome in cppcheck if palindrome c 2b 2bpalidrome numbers c 2b 2bcheck palindrome in a string c 2b 2b functionpalindrome c 2b 2b stringpalindrome functio in c 2b 2blogic for palindrome in string c 2b 2bpalindrome in c 2b 2b geeksforgeekscheck a palindrome in c 2b 2b using functioncpp palindromecheck if cpp string is palindromecheck input for palindrome in cpppalindrome of string c 2b 2bpalindrome check in c 2b 2bpalindrome c 2b 2b string examplehow to check if a number is a palindrome in c 2b 2bpalindrome string function c 2b 2bprogram for palindrome of string in c 2b 2bhow to check if a number is palindrome c 2b 2bhow to check a numbe is palindrome c 2b 2bcheck if a number is palindrome in c 2b 2bpalindrome string in c 2b 2bfunction to check palindrome string in c 2b 2bfind palindrom number in c 2b 2bpalindrome function for string c 2b 2bcheck for palindrome c 2b 2b stlhow to check palindrome in c 2b 2bpalindrome number code c 2b 2bc 2b 2b functions palindromestring palindone c 2b 2b6palindrome number in cppstring pallindrome in c 2b 2bc 2b 2b check if number is palindromecheck for palindrome in c 2b 2bpalindrome sequence of a string cppinclcheck palindrome c 2b 2bpalindrome program c 2b 2bprogram for palindrome in of number c 2b 2bcpp program to find palindromecheck if a string is a palindrome c 2b 2bpalindrome char check in c 2b 2bpalindrome simple program in string c 2b 2bwrite a program to check number palindrome and string palindrome in c 2b 2bprogram for palindrome in c 2b 2bpalindrome checker c 2b 2bcheck for palindrome cpphow to make a palindrome in c 2b 2bpalindrome string program in c 2b 2b using string functionshow to find if a given no is palindrome cppc 2b 2b program for palindrome numberhow to check if given string is palindrome in c 2b 2bstring palindrome c 2b 2bfonction palindrome c 2b 2bpalindrome check in cpppalindrome code c 2b 2b stringcheck if a string is a palindrome c 2b 2b gfgpalindrome of string cpp using stlpalindrome command line c 2b 2bpalindrome of string cpppalindrome 2b 2bstack palindrome number c 2b 2b 5cpalindrome of string in c 2b 2bcpp program to check palindrome stringhow to check the palindrome in c 2b 2bpalindrome int c 2b 2bcheck whether the string is a palindrome or not c 2b 2bfind a palindrome number in c 2b 2bc 2b 2b string palindromecheck if the string is palindrome cpppalindrome string in stl c 2b 2bpalindrome program in c 2b 2bc 2b 2b built in functions for palindrompalindrome cc 2b 2b palindrome integerstring is palindrome in c 2b 2bstring is palindrome or not in c 2b 2bcheck if string is palindrome c 2b 2bhow to make a string not palindrome in c 2b 2bpalindrome number program in c 2b 2bstring palindrome in c 2b 2b using recursionpalindrome string using function in cppdifferent ways to make a palindrome c 2b 2bcheck a palindrome in c 2b 2bpalindrome string c 2b 2bhow to check for palindrome in c 2b 2bstring is palindrome or not in cppcpp recursion palindromehow to check if a substring can be a palindrome c 2b 2bpalindrome from string c 2b 2bhow to check if a number is palindrome in c 2b 2bcheck palindrome function in cppc 2b 2b palindrome checkercheck if given number is a palindrome in c 2b 2bpalindromein cppperfect palindrome in c 2b 2bchech if string is palindrome c 2b 2bpalindrome string program in c 2b 2bpalindromic substring c 2b 2bcheck palindrome string in c 2b 2b using stlpalindrone string in c 2b 2bpallindrome function c 2b 2bc 2b 2b check palindrome stringstring is palindrome check in cppcheck palindrome in a string c 2b 2bpalindrome string ignoring cases c 2b 2bfind palindrome with string in c 2b 2bpalindrome c 2b 2b without using string functionpalindrome cpp programpalindrome number c 2b 2b programpalindrome cheacker in c 2b 2bhow to get palimdrome in c 2b 2bpalindrome string c 2b 2b with time complexitycpp program to check a number is palindromeis palindrome function c 2b 2bprint palindrome string in c 2b 2bpalindrome number in c 2b 2b using functionpalindrome code c 2b 2bpalindrome cpppalindrome number using c 2b 2b palindrome c 2b 2bc 2b 2b program for palindromepallindrome using c 2b 2bc 2b 2b check palindrome numbercpp program to check palindromec 2b 2b program to make string palindrompalindrome in c 2b 2bfastest way to check palindrome c 2b 2bchecking palindrome in c 2b 2bpalindrome c 2b 2bhow to check a no is palindrome or not in c 2b 2bpalindrome without string c 2b 2bhow to find palindrome substring in a string in cpppalindrome number c 2b 2bstring palindrome in cppto check whether inputted number is palindrome number or not c 2b 2bis palindrome string functikon c 2b 2bpalindrome c 2b 2b string in stringstring is palindrome c 2b 2bcheck palindrome string c 2b 2bc 2b 2b program to check palindrome stringcheck for a string palindrome in c 2b 2bbest way to check for palindrome in cpppalindrome with string parameters c 2b 2bc 2b 2b palindrome using stacckstring palindone c 2b 2bpalindrome program function c 2b 2bcheck if int is palindrome c 2b 2bstring palindrome check c 2b 2bc 2b 2b palindrome programpalindrome without using another string c 2b 2bpalindrome function c 2b 2bway check palindrome or not c 2b 2bpalindrome sentence algorithm c 2b 2bpalindrome function in c 2b 2bpalindrome string or not in c 2b 2bfind palindrome in string c 2b 2bcheck palindrome array c 2b 2bc 2b 2b program to check palindromecheck string palindrome efficiently c 2b 2bfinding palindrome in a string c 2b 2bcheck palindrome in c 2b 2bhow to check palindrome in cppc 2b 2b palindrome functionpalindrome number using string in c 2b 2bhow to check if string is palindrome in c 2b 2bpalindrome alpmaking a palindrome checker in c 2b 2ball palindrom substring c 2b 2bpalindrome in 8086palindrome in cpppalindrome number in c 2b 2bcheck palindrome c 2b 2bpalindrome keyword in c 2b 2bhow to check palindrome string in cppc 2b 2b code to find if given numbers are palindrome or notc 2b 2b check palindromepalindrome of string in cppcheck palindrome cppfind all possible palindromic partiions of a string in c 2b 2bpalindrome or not in c 2b 2bhow to check if a string is palindrome in c 2b 2bcheck is palindrome c 2b 2bstring is palindrome or not c 2b 2bpalindrome numbers c 2b 2bcheck if a string is palindrome c 2b 2bis string a palindrome c 2b 2bhow to check whether the number is palindrome or not c 2b 2bthe palindrome game c 2b 2b solutionis palindrome string cppcheck a number palindrome or not in c 2b 2bcheck palindrome string in cppprogram to check for palindrome in c 2b 2b using stlsimple program for palindrome string in c 2b 2bcheck which part of a string is palindrome c 2b 2bfind whether the given number is palindrome or not in c 2b 2bis palindrome string c 2b 2bcheck palindrome int c 2b 2bc 2b 2b pattern programs palindrome of a numberchecking palindrome c 2b 2bhow to check a string is palindrome or not in c 2b 2bpalindrome c 2b 2b efficientcheck palindrome in c 2b 2b stlpalindrome check c 2b 2bpalindrome in c 2b 2b stringthe c 2b 2bpalindrome cyclepalindrome number patterns c 2b 2bto find palindron c 2b 2bsimple cpp to check palindrome of given user datac 2b 2b palindromestring palindromes c 2b 2bcheck if a number is palindrome c 2b 2bnumber palindrome or not cpppalindrome stl c 2b 2bpalindrome checker in c 2b 2bpalindrome solution i cppcheck palindrome number in c 2b 2bpalindrome of a string in c 2b 2bpalindrome solution in cpparray palindrome c 2b 2bcheck palindrome in cppc 2b 2b longest palindrome stringpalindrom in cpphow to check if a string can be a palindrome c 2b 2bprogram for palindrome string in c 2b 2bstrcmp to checkc for palindrome c 2b 2bis 26 a palindromesolving palindrome problem in c 2b 2bpalindrome n c 2b 2bpalindrome of a number c 2b 2bhow to check palindrome cppis palindrome c 2b 2bmake palindrome c 2b 2bpalindrome of a string c 2b 2bsee if a string is palindrome c 2b 2bc 2b 2b program to print palindromepalindrome array in c 2b 2bpalindrome program in c 2b 2b using string functionsfind palindrome string c 2b 2blogic of palindrome in c 2b 2bpalindrome in string c 2b 2bpalindrome program for cpppalindrome numbers in c 2b 2bhwo to make a string palindrome in c 2b 2bc 2b 2b program to check if string is palindromemost efficient way to find palidrome in string c 2b 2bpalindrome number cpppalindrome number program in cpppalindrome c 2b 2bc 2b 2b program to find palindrome numberefficient way to check palindrome c 2b 2bpalindrone no cpppalindrome algorithm in c 2b 2bhow to check if number is palindrome in c 2b 2bhow to use next palindrome in c 2b 2b stringcheck palindrome of number c 2b 2bstring palindrome program in c 2b 2bc 2b 2b program to find a palindeomecheck palindrome c 2b 2b geeksc 2b 2b program to find palindromebuilt in function for palindrome in c 2b 2bvalid palindrome iileetcode solution c 2b 2bcheck string palindrome in c 2b 2bpalindrome string gfg in c 2b 2bpalindrome algorithm c 2b 2bpalindrome c 2b 2bhow to check palindrome c 2b 2b stringrange palindrome queries c 2b 2bstring palindrome in c 2b 2b geeksforgeeksmake palindrome from string in cppcalculate palindrome number c 2b 2bpalindrome series in c 2b 2bvalid palindrome c 2b 2bstring palindrome program in c 2b 2b using for loopmake a string palindrome c 2b 2bstring palindrome in c 2b 2bnumber palindrome c 2b 2bpalindrome integer c 2b 2bpalindrome array c 2b 2bhow to create a palindrome in c 2b 2bprime numbers palindrome number and leap year like examplespalindrome string in cpphow to check string is palindrome or not in c 2b 2bpalindrome program check string in c 2b 2bnumber is palindrome or not c 2b 2bpalindrome function cpppalindrome in number c 2b 2bin c 2b 2b write a function of palindromecheck if number is palindrome c 2b 2bc 2b 2b inbuilt function for palindrome c 2b 2b string palindrome in stringpalindrome code in c 2b 2bcheck if a string is palindrome in c 2b 2bpalindrome c 2b 2b number 5cwrite a program to check a string is palindrome or not in c 2b 2bpalindrome c 2b 2b