Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstring>
- #include <string>
- using namespace std;
- int main() {
- string rec;
- cout << "Unesite rec: ";
- cin >> rec;
- int duzina = rec.length()-1;
- bool status = false;
- for(int i = 0; i < duzina; i++){
- if (rec.at(i) != rec.at(duzina-i)) {
- status = true;
- break;
- }
- }
- if (status == true){
- cout<< "Nije palindrom";
- } else {
- cout<< "Jeste palindrom";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement