Search
 
SCRIPT & CODE EXAMPLE
 

CPP

c++ check palindrome

#include<iostream>
#include<ctype.h>
using namespace std;
int main() {
	string s; cin >> s;
	int a = 0;
	for(int i = 0; i < (s.length() / 2); i++) 
		if(s[i] == s[s.length() - 1 - i]) a++;
	if(a == (s.length() / 2)) cout << "YES";
	else cout << "NO";
	return 0;
}
Comment

palindrome checker in c++

#include<iostream>
using namespace std;

int main()
{
	string s1, s2;
	cout << "Enter string: ";
	cin >> s1;

	for (int i = s1.length()-1; i >= 0; i--)
	{
		s2 += s1[i];
	}

	if (s1 == s2)
	{
		cout << "Palindrome!" << endl;
	}
	else
	{
		cout << "Not Palindrome!" << endl;
	}

	return 0;
}
Comment

palindrome program in c++

#include <iostream>


bool isPalindrome (int number) {
    int decomposed = number, reversed = 0;
    while (decomposed) {
        reversed = 10 * reversed + (decomposed % 10);
        decomposed /= 10;
    }
    return reversed == number;
}
Comment

Palindrome String solution in c++

class Solution{
public:	
	
	
	int isPalindrome(string S)
	{
	    // Your code goes here
        int n=S.length();
        for(int i=0;i<n/2;i++)
        {
            if(S[i]!=S[n-1-i])
            {
                return 0;
            }
        }
        return 1;
	}

};
Comment

PREVIOUS NEXT
Code Example
Cpp :: c++ thread incide class 
Cpp :: cannot jump from switch statement to this case label c++ 
Cpp :: deep copy c++ 
Cpp :: overload of << c++ 
Cpp :: c++ casting 
Cpp :: min in c++ 
Cpp :: calculate factorial 
Cpp :: hello world in c/++ 
Cpp :: cpp vs c# 
Cpp :: how to get the time in c++ as string 
Cpp :: function in c++ 
Cpp :: cpp return array 
Cpp :: ++i and i++ 
Cpp :: stack overflow c++ 
Cpp :: c elif 
Cpp :: print pattern and space in cpp 
Cpp :: operand-- c++ 
Cpp :: stack c++ 
Cpp :: define in cpp 
Cpp :: c ++ splitlines 
Cpp :: c++ move semantics for `this` 
Cpp :: how to create a file in c++ 
Cpp :: c++ changing string to double 
Cpp :: c++ math 
Cpp :: how to grab each character from a string 
Cpp :: c++ program to convert celsius to kelvin 
Cpp :: hello world cc++ 
Cpp :: Find duplicates in an array geeks for geeks solution in cpp 
Cpp :: linear search 
Cpp :: how to print a word in c++ 
ADD CONTENT
Topic
Content
Source link
Name
9+6 =