Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- Write a program that finds if a string is a palindrome.
- */
- #include <iostream>
- #include <string>
- using namespace std;
- void palindromeFind(string myString)
- {
- string backwards;
- for (int i = myString.length() - 1; i < myString.length(); i--)
- {
- backwards = backwards + myString[i];
- }
- if (backwards == myString)
- cout << "palindrome";
- else
- cout << "not a plaindrome";
- }
- int main()
- {
- string x;
- getline(cin, x);
- palindromeFind(x);
- cin.get();
- cin.get();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement