Advertisement
soyan_bid

str_rev

Jan 22nd, 2016
744
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.46 KB | None | 0 0
  1. #include "iostream"
  2. #include "string.h"
  3.  
  4. using namespace std;
  5.  
  6. main()
  7. {
  8.     char input[64];
  9.     char rev_str[64];
  10.     cout << "input : ";
  11.     cin >> input;
  12.     strlwr(input);
  13.     strcpy(rev_str,input);
  14.     strrev(rev_str);
  15.     cout << "reverse : " << rev_str << endl;
  16.     if(strcmp(input,rev_str) == 0)
  17.     {
  18.         cout << input << " is palindrome" << endl;
  19.     }
  20.     else
  21.     {
  22.         cout << input << " isn't palindrome" << endl;
  23.     }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement