---
title: "Palindrome String"
description: "c plus plus example for palindrome string"
url: "https://www.geekboots.com/cpp/palindrome-string"
markdown_url: "https://www.geekboots.com/cpp/palindrome-string/md"
category: "C++ Programming"
author: "Geekboots"
published: "2016-06-06"
updated: "2026-11-28T21:28:52.431Z"
tags: ["palindrome string", "palindrome string", "C plus plus"]
---

# Palindrome String (C++ Programming)

> c plus plus example for palindrome string

## Source Code

### palindrome-string.cpp

```cpp
#include<iostream> 

/* Contains functions for manipulating data */
#include<algorithm>
using namespace std; 

int main() {

	/* Declear string type variable in C++ */
	string str;
	cout << "Check the given string is Palindrome or not" << endl;
	cout << "Enter a string:" << endl; 
	cin >> str; 
	
	/* begin() and end() rbegin() are iterators for beginning and end */
	/* equal() compares the elements */
	if(equal(str.begin(), str.end(), str.rbegin()))
        	cout << "It's a palindrome string" << endl; 
	else 
		cout << "It's not a palindrome string!" << endl; 

	return 0;
}



/* Output */
Check the given string is Palindrome or not
Enter a string:
abcba

It's a palindrome string!



/* ---------------------------------- */



Check the given string is Palindrome or not
Enter a string:
asdfg

It's not a palindrome string!
```

## Related Code Examples

- [STL Min Max](https://www.geekboots.com/cpp/stl-min-max) ([Markdown](https://www.geekboots.com/cpp/stl-min-max/md))
- [Multimap](https://www.geekboots.com/cpp/multimap) ([Markdown](https://www.geekboots.com/cpp/multimap/md))
- [Map](https://www.geekboots.com/cpp/map) ([Markdown](https://www.geekboots.com/cpp/map/md))
- [Binary Tree](https://www.geekboots.com/cpp/binary-tree) ([Markdown](https://www.geekboots.com/cpp/binary-tree/md))
- [Double Ended Queue](https://www.geekboots.com/cpp/deque) ([Markdown](https://www.geekboots.com/cpp/deque/md))
- [Queue](https://www.geekboots.com/cpp/queue) ([Markdown](https://www.geekboots.com/cpp/queue/md))
- [Stack](https://www.geekboots.com/cpp/stack) ([Markdown](https://www.geekboots.com/cpp/stack/md))
- [Doubly Linked list](https://www.geekboots.com/cpp/doubly-linkedlist) ([Markdown](https://www.geekboots.com/cpp/doubly-linkedlist/md))

---
Source: [Geekboots](https://www.geekboots.com/cpp/palindrome-string)
