Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- main()
- {
- string s, k;
- int n; bool p;
- getline (cin, s);
- // Dio koji brise razmake i pretvara cio string u mala slova
- for (int i=0; i<s.length(); i++)
- {
- if (s[i]!=' ')
- {
- if (s[i] < 91)
- {
- s[i] = s[i] + 32;
- k = k + s[i];
- }
- else
- k = k + s[i];
- }
- }
- n = k.length();
- p = true;
- for (int i=0; i<n/2; i++)
- if (k[i] != k[n-i-1])
- p = false;
- if (p==true)
- cout << "Jeste palindrom! " << endl;
- else
- cout << "Nije palindrom! " << endl;
- // cout << k;
- system ("PAUSE");
- }
Advertisement
Add Comment
Please, Sign In to add comment