Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- char a[101];
- int VerifPalindrom(char a[])
- {
- int n, i;
- for(n = 0; a[n] != 0; n++);
- i = 0;n--;
- while(i <= n)
- {
- if(a[i] != a[n]) return 0;
- i++;n--;
- }
- return 1;
- }
- int VerifPalindrom2(char a[])
- {
- int n, i;
- for(n = 0; a[n] != 0; n++);
- i = 0;n--;
- while(i <= n)
- {
- if(a[i] - a[n] == 0 || a[i] - a[n] == 32 || a[i] - a[n] == -32);
- else return 0;
- i++;n--;
- }
- return 1;
- }
- int main()
- {
- cout << "a: ";cin.getline(a, 101);
- cout << VerifPalindrom(a) << "\n";
- cout << VerifPalindrom2(a) << "\n";
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement