Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstdlib>
- #include <time.h>
- #include <math.h>
- #include <string>
- using namespace std;
- void palindrome(string,int);
- int roz=0;
- string s1;
- int main(){
- srand(time(0));
- getline(cin,s1);
- roz=s1.size();
- cout<<endl;
- palindrome(s1,roz);
- return 0;
- }
- void palindrome(string s,int r)
- {
- string reversee=s;;
- for(int i=0,j=r-1;i<roz;i++,j--)
- {
- reversee[j]=s[i];
- }
- if((s1.compare(reversee))==0)
- {
- cout<<"Palindrome!";
- }
- else {cout<<"Not Palindrome";}
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement